hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [1/2] httpcomponents-core git commit: [HTTPCORE-496] Add API org.apache.http.protocol.UriPatternMatcher.entrySet() [Forced Update!]
Date Wed, 06 Dec 2017 08:42:14 GMT
Repository: httpcomponents-core
Updated Branches:
  refs/heads/master 04c420f94 -> c81801f8a (forced update)


[HTTPCORE-496] Add API org.apache.http.protocol.UriPatternMatcher.entrySet()


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/ffbe8aae
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/ffbe8aae
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/ffbe8aae

Branch: refs/heads/master
Commit: ffbe8aae055be99d949455cf296e2e16a2c57b5d
Parents: c86029c
Author: Gary Gregory <ggregory@apache.org>
Authored: Tue Dec 5 14:22:34 2017 -0700
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Wed Dec 6 09:38:52 2017 +0100

----------------------------------------------------------------------
 RELEASE_NOTES.txt                                   | 10 ++++++++++
 .../hc/core5/http/protocol/UriPatternMatcher.java   | 14 ++++++++++++++
 .../core5/http/protocol/TestUriPatternMatcher.java  | 16 ++++++++++++++++
 3 files changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ffbe8aae/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 0153927..e03aece 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,3 +1,13 @@
+Release 5.0-BETA2
+-------------------
+
+Changelog
+-------------------
+
+* HTTPCORE-496: Add API org.apache.http.protocol.UriPatternMatcher.entrySet().
+  Contributed by Gary Gregory <ggregory at apache.org>
+
+
 Release 5.0-BETA1
 -------------------
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ffbe8aae/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriPatternMatcher.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriPatternMatcher.java
b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriPatternMatcher.java
index ac5233e..f6bc730 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriPatternMatcher.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriPatternMatcher.java
@@ -29,6 +29,8 @@ package org.apache.hc.core5.http.protocol;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
 
 import org.apache.hc.core5.annotation.Contract;
 import org.apache.hc.core5.annotation.ThreadingBehavior;
@@ -59,6 +61,18 @@ public class UriPatternMatcher<T> implements LookupRegistry<T>
{
     }
 
     /**
+     * Returns a {@link Set} view of the mappings contained in this matcher.
+     *
+     * @return  a set view of the mappings contained in this matcher.
+     *
+     * @see Map#entrySet()
+     * @since 4.4.9
+     */
+    public Set<Entry<String, T>> entrySet() {
+        return map.entrySet();
+    }
+
+    /**
      * Registers the given object for URIs matching the given pattern.
      *
      * @param pattern

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ffbe8aae/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternMatcher.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternMatcher.java
b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternMatcher.java
index 2ae9592..ef45281 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternMatcher.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternMatcher.java
@@ -33,6 +33,22 @@ import org.junit.Test;
 public class TestUriPatternMatcher {
 
     @Test
+    public void testEntrySet() throws Exception {
+        final Object h1 = new Object();
+        final Object h2 = new Object();
+        final Object h3 = new Object();
+
+        final UriPatternMatcher<Object> matcher = new UriPatternMatcher<>();
+        Assert.assertEquals(0, matcher.entrySet().size());
+        matcher.register("/h1", h1);
+        Assert.assertEquals(1, matcher.entrySet().size());
+        matcher.register("/h2", h2);
+        Assert.assertEquals(2, matcher.entrySet().size());
+        matcher.register("/h3", h3);
+        Assert.assertEquals(3, matcher.entrySet().size());
+    }
+
+    @Test
     public void testRegisterUnregister() throws Exception {
         final Object h1 = new Object();
         final Object h2 = new Object();


Mime
View raw message