You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2020/01/01 13:27:54 UTC

[httpcomponents-core] 01/02: Don't use plural names for enums

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit c4a68cc663e0c30e03ff27af6fb4866a9fd6435f
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Tue Dec 31 21:58:32 2019 +0100

    Don't use plural names for enums
    
    Stick to the general convention that enum are singular only.
---
 .../apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java | 6 +++---
 .../apache/hc/core5/testing/classic/ClassicAuthenticationTest.java  | 4 ++--
 .../hc/core5/testing/classic/ClassicServerAndRequesterTest.java     | 4 ++--
 .../org/apache/hc/core5/testing/nio/Http1AuthenticationTest.java    | 4 ++--
 .../apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java    | 4 ++--
 .../apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java   | 4 ++--
 .../org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java    | 4 ++--
 .../impl/bootstrap/{StandardFilters.java => StandardFilter.java}    | 2 +-
 .../org/apache/hc/core5/http/examples/AsyncServerFilterExample.java | 4 ++--
 .../apache/hc/core5/http/examples/ClassicServerFilterExample.java   | 4 ++--
 10 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
index 5d42e29..071fa74 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
@@ -40,7 +40,7 @@ import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
 import org.apache.hc.core5.http.impl.Http1StreamListener;
 import org.apache.hc.core5.http.impl.HttpProcessors;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncServer;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.impl.nio.DefaultHttpRequestParserFactory;
 import org.apache.hc.core5.http.impl.nio.DefaultHttpResponseWriterFactory;
 import org.apache.hc.core5.http.impl.nio.ServerHttp1StreamDuplexerFactory;
@@ -375,10 +375,10 @@ public class H2ServerBootstrap {
             final NamedElementChain<AsyncFilterHandler> filterChainDefinition = new NamedElementChain<>();
             filterChainDefinition.addLast(
                     new TerminalAsyncServerFilter(new DefaultAsyncResponseExchangeHandlerFactory(registry)),
-                    StandardFilters.MAIN_HANDLER.name());
+                    StandardFilter.MAIN_HANDLER.name());
             filterChainDefinition.addFirst(
                     new AsyncServerExpectationFilter(),
-                    StandardFilters.EXPECT_CONTINUE.name());
+                    StandardFilter.EXPECT_CONTINUE.name());
 
             for (final FilterEntry<AsyncFilterHandler> entry: filters) {
                 switch (entry.postion) {
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java
index 418b155..c14254d 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicAuthenticationTest.java
@@ -47,7 +47,7 @@ import org.apache.hc.core5.http.impl.bootstrap.HttpRequester;
 import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
 import org.apache.hc.core5.http.impl.bootstrap.RequesterBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.io.SocketConfig;
 import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
 import org.apache.hc.core5.http.io.entity.EntityUtils;
@@ -103,7 +103,7 @@ public class ClassicAuthenticationTest {
                                     .setSoTimeout(TIMEOUT)
                                     .build())
                     .register("*", new EchoHandler())
-                    .replaceFilter(StandardFilters.EXPECT_CONTINUE.name(), new AbstractHttpServerAuthFilter<String>(respondImmediately) {
+                    .replaceFilter(StandardFilter.EXPECT_CONTINUE.name(), new AbstractHttpServerAuthFilter<String>(respondImmediately) {
 
                         @Override
                         protected String parseChallengeResponse(
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java
index 82b90e7..462cd8d 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/classic/ClassicServerAndRequesterTest.java
@@ -45,7 +45,7 @@ import org.apache.hc.core5.http.impl.bootstrap.HttpRequester;
 import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
 import org.apache.hc.core5.http.impl.bootstrap.RequesterBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.io.HttpFilterChain;
 import org.apache.hc.core5.http.io.HttpFilterHandler;
 import org.apache.hc.core5.http.io.SocketConfig;
@@ -101,7 +101,7 @@ public class ClassicServerAndRequesterTest {
                             .setSoTimeout(TIMEOUT)
                             .build())
                     .register("*", new EchoHandler())
-                    .addFilterBefore(StandardFilters.MAIN_HANDLER.name(), "no-keep-alive", new HttpFilterHandler() {
+                    .addFilterBefore(StandardFilter.MAIN_HANDLER.name(), "no-keep-alive", new HttpFilterHandler() {
 
                         @Override
                         public void handle(
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1AuthenticationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1AuthenticationTest.java
index 3fec96f..554cf4d 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1AuthenticationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1AuthenticationTest.java
@@ -49,7 +49,7 @@ import org.apache.hc.core5.http.impl.bootstrap.AsyncRequesterBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.AsyncServerBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncRequester;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncServer;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.message.BasicHttpRequest;
 import org.apache.hc.core5.http.nio.AsyncEntityProducer;
 import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
@@ -117,7 +117,7 @@ public class Http1AuthenticationTest {
                         }
 
                     })
-                    .replaceFilter(StandardFilters.EXPECT_CONTINUE.name(), new AbstractAsyncServerAuthFilter<String>(respondImmediately) {
+                    .replaceFilter(StandardFilter.EXPECT_CONTINUE.name(), new AbstractAsyncServerAuthFilter<String>(respondImmediately) {
 
                         @Override
                         protected String parseChallengeResponse(
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
index cee7786..484fa9d 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
@@ -52,7 +52,7 @@ import org.apache.hc.core5.http.impl.bootstrap.AsyncRequesterBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.AsyncServerBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncRequester;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncServer;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.message.BasicHttpRequest;
 import org.apache.hc.core5.http.nio.AsyncClientEndpoint;
 import org.apache.hc.core5.http.nio.AsyncDataConsumer;
@@ -127,7 +127,7 @@ public class Http1ServerAndRequesterTest {
                         }
 
                     })
-                    .addFilterBefore(StandardFilters.MAIN_HANDLER.name(), "no-keepalive", new AsyncFilterHandler() {
+                    .addFilterBefore(StandardFilter.MAIN_HANDLER.name(), "no-keepalive", new AsyncFilterHandler() {
 
                         @Override
                         public AsyncDataConsumer handle(
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java
index 33088c5..d7b0560 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServerBootstrap.java
@@ -353,10 +353,10 @@ public class AsyncServerBootstrap {
             final NamedElementChain<AsyncFilterHandler> filterChainDefinition = new NamedElementChain<>();
             filterChainDefinition.addLast(
                     new TerminalAsyncServerFilter(new DefaultAsyncResponseExchangeHandlerFactory(registry)),
-                    StandardFilters.MAIN_HANDLER.name());
+                    StandardFilter.MAIN_HANDLER.name());
             filterChainDefinition.addFirst(
                     new AsyncServerExpectationFilter(),
-                    StandardFilters.EXPECT_CONTINUE.name());
+                    StandardFilter.EXPECT_CONTINUE.name());
 
             for (final FilterEntry<AsyncFilterHandler> entry: filters) {
                 switch (entry.postion) {
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java
index 82a90b8..dbf5c20 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/ServerBootstrap.java
@@ -345,10 +345,10 @@ public class ServerBootstrap {
                     new TerminalServerFilter(
                             handlerRegistry,
                             this.responseFactory != null ? this.responseFactory : DefaultClassicHttpResponseFactory.INSTANCE),
-                    StandardFilters.MAIN_HANDLER.name());
+                    StandardFilter.MAIN_HANDLER.name());
             filterChainDefinition.addFirst(
                     new HttpServerExpectationFilter(),
-                    StandardFilters.EXPECT_CONTINUE.name());
+                    StandardFilter.EXPECT_CONTINUE.name());
 
             for (final FilterEntry<HttpFilterHandler> entry: filters) {
                 switch (entry.postion) {
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilters.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilter.java
similarity index 97%
rename from httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilters.java
rename to httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilter.java
index 9864901..65a0381 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilters.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/StandardFilter.java
@@ -33,7 +33,7 @@ package org.apache.hc.core5.http.impl.bootstrap;
  * @see AsyncServerBootstrap
  * @see ServerBootstrap
  */
-public enum StandardFilters {
+public enum StandardFilter {
 
     EXPECT_CONTINUE, MAIN_HANDLER
 
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
index 8cce0da..fd8c6b0 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
@@ -39,7 +39,7 @@ import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.Message;
 import org.apache.hc.core5.http.impl.bootstrap.AsyncServerBootstrap;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncServer;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.message.BasicHttpResponse;
 import org.apache.hc.core5.http.nio.AsyncDataConsumer;
 import org.apache.hc.core5.http.nio.AsyncEntityProducer;
@@ -81,7 +81,7 @@ public class AsyncServerFilterExample {
 
                 // Replace standard expect-continue handling with a custom auth filter
 
-                .replaceFilter(StandardFilters.EXPECT_CONTINUE.name(), new AbstractAsyncServerAuthFilter<String>(true) {
+                .replaceFilter(StandardFilter.EXPECT_CONTINUE.name(), new AbstractAsyncServerAuthFilter<String>(true) {
 
                     @Override
                     protected String parseChallengeResponse(
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
index 4bde8a5..2708b8a 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/ClassicServerFilterExample.java
@@ -38,7 +38,7 @@ import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.io.SocketConfig;
 import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
 import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
-import org.apache.hc.core5.http.impl.bootstrap.StandardFilters;
+import org.apache.hc.core5.http.impl.bootstrap.StandardFilter;
 import org.apache.hc.core5.http.io.HttpFilterChain;
 import org.apache.hc.core5.http.io.HttpFilterHandler;
 import org.apache.hc.core5.http.io.HttpRequestHandler;
@@ -71,7 +71,7 @@ public class ClassicServerFilterExample {
 
                 // Replace standard expect-continue handling with a custom auth filter
 
-                .replaceFilter(StandardFilters.EXPECT_CONTINUE.name(), new AbstractHttpServerAuthFilter<String>(false) {
+                .replaceFilter(StandardFilter.EXPECT_CONTINUE.name(), new AbstractHttpServerAuthFilter<String>(false) {
 
                     @Override
                     protected String parseChallengeResponse(