servicecomb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] WillemJiang closed pull request #563: SCB-361 fix access log compilation warning
Date Thu, 01 Mar 2018 13:19:54 GMT
WillemJiang closed pull request #563: SCB-361 fix access log compilation warning
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/563
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/src/main/java/org/apache/servicecomb/core/provider/consumer/InvokerUtils.java
b/core/src/main/java/org/apache/servicecomb/core/provider/consumer/InvokerUtils.java
index 8a4829934..f15c6bb6d 100644
--- a/core/src/main/java/org/apache/servicecomb/core/provider/consumer/InvokerUtils.java
+++ b/core/src/main/java/org/apache/servicecomb/core/provider/consumer/InvokerUtils.java
@@ -60,7 +60,6 @@ public static Object syncInvoke(Invocation invocation) throws InvocationExceptio
   }
 
   public static Response innerSyncInvoke(Invocation invocation) {
-    boolean success = false;
     int statusCode = 0;
     try {
       triggerStartedEvent(invocation);
diff --git a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
index 68074c60f..42d543752 100644
--- a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
+++ b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/SpringmvcClient.java
@@ -90,7 +90,7 @@ public static void run() {
         "Test sayhi compressed:This is a big text,This is a big text,This is a big text,This
is a big text,This is a big text,This is a big text,This is a big text,This is a big text,This
is a big text,This is a big text,This is a big text,This is a big text,This is a big text,This
is a big text,This is a big text,This is a big text,This is a big text,This is a big text,This
is a big text,This is a big text,This is a big text,This is a big text,This is a big text,This
is a big text,This is a big text,This is a big text,This is a big text,This is a big text,This
is a big text,This is a big text,This is a big text,This is a big text,This is a big text,This
is a big text,This is a big text,This is a big text,This is a big text,This is a big text,This
is a big text,This is a big text,This is a big text,This is a big text,This is a big text,This
is a big text,This is a big text,This is a big text,This is a big text,This is a big text!",
         entityCompress.getBody());
     // if server response is compressed, the content-length header will be removed , so can't
check this.
-    // the transfer-encoding header will be missing when the server is setted to not compressed
+    // the transfer-encoding header will be missing when the server is set to not compressed
     if (entityCompress.getHeaders().get("transfer-encoding") != null) {
       TestMgr.check("chunked", entityCompress.getHeaders().get("transfer-encoding").get(0));
     }
@@ -98,14 +98,15 @@ public static void run() {
     //0.5.0 later version metrics integration test
     try {
       Thread.sleep(1000);
+      @SuppressWarnings("unchecked")
       Map<String, Double> metrics = restTemplate.getForObject(prefix + "/metrics",
Map.class);
 
       TestMgr
           .check(true, metrics.get("jvm(name=heapUsed,statistic=gauge)") != 0);
       TestMgr.check(true, metrics.size() > 0);
-      TestMgr.check(true, metrics.get(
-          "servicecomb.invocation(operation=springmvc.codeFirst.saySomething,role=producer,stage=total,statistic=count,status=200)")
-          >= 0);
+      TestMgr.check(true,
+          metrics.get(
+              "servicecomb.invocation(operation=springmvc.codeFirst.saySomething,role=producer,stage=total,statistic=count,status=200)")
>= 0);
     } catch (Exception e) {
       TestMgr.check("true", "false");
     }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGenerator.java
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGenerator.java
index da9dbf45d..a81eb584a 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGenerator.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGenerator.java
@@ -24,6 +24,8 @@
 import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.AccessLogItemLocation;
 import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.AccessLogPatternParser;
 
+import io.vertx.ext.web.RoutingContext;
+
 /**
  * Accept {@link AccessLogParam} and generate access log.
  * <br/>
@@ -33,23 +35,24 @@
   /**
    * traversal this array to generate access log segment.
    */
-  private AccessLogItem[] accessLogItems;
+  private AccessLogItem<RoutingContext>[] accessLogItems;
 
   private AccessLogItemFactory accessLogItemFactory = new AccessLogItemFactory();
 
+  @SuppressWarnings("unchecked")
   public AccessLogGenerator(String rawPattern, AccessLogPatternParser accessLogPatternParser)
{
     List<AccessLogItemLocation> locationList = accessLogPatternParser.parsePattern(rawPattern);
 
-    List<AccessLogItem> itemList = accessLogItemFactory.createAccessLogItem(rawPattern,
locationList);
+    List<AccessLogItem<RoutingContext>> itemList = accessLogItemFactory.createAccessLogItem(rawPattern,
locationList);
     accessLogItems = new AccessLogItem[itemList.size()];
     accessLogItems = itemList.toArray(accessLogItems);
   }
 
-  public String generateLog(AccessLogParam accessLogParam) {
+  public String generateLog(AccessLogParam<RoutingContext> accessLogParam) {
     StringBuilder log = new StringBuilder(128);
     accessLogParam.setEndMillisecond(System.currentTimeMillis());
 
-    AccessLogItem[] accessLogItems = getAccessLogItems();
+    AccessLogItem<RoutingContext>[] accessLogItems = getAccessLogItems();
     for (int i = 0; i < accessLogItems.length; ++i) {
       log.append(accessLogItems[i].getFormattedItem(accessLogParam));
     }
@@ -58,7 +61,7 @@ public String generateLog(AccessLogParam accessLogParam) {
   }
 
 
-  private AccessLogItem[] getAccessLogItems() {
+  private AccessLogItem<RoutingContext>[] getAccessLogItems() {
     return accessLogItems;
   }
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/AccessLogItemFactory.java
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/AccessLogItemFactory.java
index 9e1387d70..f18e80d78 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/AccessLogItemFactory.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/AccessLogItemFactory.java
@@ -26,17 +26,20 @@
 import org.apache.servicecomb.transport.rest.vertx.accesslog.element.creator.SimpleAccessLogItemCreator;
 import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.AccessLogItemLocation;
 
+import io.vertx.ext.web.RoutingContext;
+
 /**
  * The factory of {@link AccessLogItem}.
  * Using the {@link AccessLogItemCreator} to generate AccessLogItem, according to {@link
AccessLogItemLocation}
  * and rawPattern.
  */
 public class AccessLogItemFactory {
-  private List<AccessLogItemCreator> creatorList = Arrays
+  private List<AccessLogItemCreator<RoutingContext>> creatorList = Arrays
       .asList(new SimpleAccessLogItemCreator(), new PercentagePrefixConfigurableItemCreator());
 
-  public List<AccessLogItem> createAccessLogItem(String rawPattern, List<AccessLogItemLocation>
locationList) {
-    List<AccessLogItem> itemList = new ArrayList<>();
+  public List<AccessLogItem<RoutingContext>> createAccessLogItem(String rawPattern,
+      List<AccessLogItemLocation> locationList) {
+    List<AccessLogItem<RoutingContext>> itemList = new ArrayList<>();
     for (AccessLogItemLocation location : locationList) {
       setItemList(rawPattern, itemList, location);
     }
@@ -47,9 +50,10 @@
   /**
    * generate single AccessLogItem
    */
-  private void setItemList(String rawPattern, List<AccessLogItem> itemList, AccessLogItemLocation
location) {
-    AccessLogItem item = null;
-    for (AccessLogItemCreator creator : creatorList) {
+  private void setItemList(String rawPattern, List<AccessLogItem<RoutingContext>>
itemList,
+      AccessLogItemLocation location) {
+    AccessLogItem<RoutingContext> item = null;
+    for (AccessLogItemCreator<RoutingContext> creator : creatorList) {
       item = creator.create(rawPattern, location);
       if (null != item) {
         break;
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/AccessLogItemCreator.java
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/AccessLogItemCreator.java
index 6a3f52950..5a31f1fa2 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/AccessLogItemCreator.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/AccessLogItemCreator.java
@@ -23,6 +23,6 @@
 /**
  * The actual creator of AccessLogItem.
  */
-public interface AccessLogItemCreator {
-  AccessLogItem create(String rawPattern, AccessLogItemLocation location);
+public interface AccessLogItemCreator<T> {
+  AccessLogItem<T> create(String rawPattern, AccessLogItemLocation location);
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/PercentagePrefixConfigurableItemCreator.java
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/PercentagePrefixConfigurableItemCreator.java
index bc021bd22..0ab1ae5b4 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/PercentagePrefixConfigurableItemCreator.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/PercentagePrefixConfigurableItemCreator.java
@@ -26,13 +26,15 @@
 import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.AccessLogItemLocation;
 import org.apache.servicecomb.transport.rest.vertx.accesslog.placeholder.AccessLogItemTypeEnum;
 
+import io.vertx.ext.web.RoutingContext;
+
 /**
  * Some access log item contains changeable part, so we should get it's configuration from
rawPattern, and generate it
  * each time it is needed.
  */
-public class PercentagePrefixConfigurableItemCreator implements AccessLogItemCreator {
+public class PercentagePrefixConfigurableItemCreator implements AccessLogItemCreator<RoutingContext>
{
   @Override
-  public AccessLogItem create(String rawPattern, AccessLogItemLocation location) {
+  public AccessLogItem<RoutingContext> create(String rawPattern, AccessLogItemLocation
location) {
     String config = getConfig(rawPattern, location);
     switch (location.getPlaceHolder()) {
       case DATETIME_CONFIGURABLE:
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/SimpleAccessLogItemCreator.java
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/SimpleAccessLogItemCreator.java
index e9acadd6a..3e4983e25 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/SimpleAccessLogItemCreator.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/SimpleAccessLogItemCreator.java
@@ -39,13 +39,16 @@
 import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.AccessLogItemLocation;
 import org.apache.servicecomb.transport.rest.vertx.accesslog.placeholder.AccessLogItemTypeEnum;
 
+import io.vertx.ext.web.RoutingContext;
+
 /**
  * For some access log items, their placeholder contains no modifiable part, like "%s" or
"sc-status".
  * So we can build a mapping relationship between the placeholder and item instances, when
an item is needed, get it by
  * it's placeholder.
  */
-public class SimpleAccessLogItemCreator implements AccessLogItemCreator {
-  private static final Map<AccessLogItemTypeEnum, AccessLogItem> SIMPLE_ACCESSLOG_ITEM_MAP
= new HashMap<>();
+public class SimpleAccessLogItemCreator implements AccessLogItemCreator<RoutingContext>
{
+  private static final Map<AccessLogItemTypeEnum, AccessLogItem<RoutingContext>>
SIMPLE_ACCESSLOG_ITEM_MAP =
+      new HashMap<>();
 
   static {
     SIMPLE_ACCESSLOG_ITEM_MAP.put(AccessLogItemTypeEnum.HTTP_METHOD, new HttpMethodItem());
@@ -67,7 +70,7 @@
   }
 
   @Override
-  public AccessLogItem create(String rawPattern, AccessLogItemLocation location) {
+  public AccessLogItem<RoutingContext> create(String rawPattern, AccessLogItemLocation
location) {
     return SIMPLE_ACCESSLOG_ITEM_MAP.get(location.getPlaceHolder());
   }
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItem.java
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItem.java
index d139cce43..740c474de 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItem.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItem.java
@@ -26,10 +26,12 @@
 import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
 import org.springframework.util.StringUtils;
 
+import io.vertx.ext.web.RoutingContext;
+
 /**
- * Configurable datetime element.
+ * Configurable dateTime element.
  */
-public class DatetimeConfigurableItem implements AccessLogItem {
+public class DatetimeConfigurableItem implements AccessLogItem<RoutingContext> {
 
   public static final String DEFAULT_DATETIME_PATTERN = "EEE, dd MMM yyyy HH:mm:ss zzz";
 
@@ -44,7 +46,7 @@
   private Locale locale;
 
   /**
-   * all config is set to default value.
+   * all configuration is set to default value.
    */
   public DatetimeConfigurableItem() {
     this(DEFAULT_DATETIME_PATTERN);
@@ -52,14 +54,14 @@ public DatetimeConfigurableItem() {
 
   /**
    * the configurations not specified will get a default value.
-   * @param config the format of config is "PATTERN|TIMEZONE|LOCALE" or "PATTERN". It depends
on whether the config contains the separator "|"
+   * @param config the format of configuration is "PATTERN|TIMEZONE|LOCALE" or "PATTERN".
It depends on whether the config contains the separator "|"
    */
   public DatetimeConfigurableItem(String config) {
     String[] configArr = null;
     if (config.contains("|")) {
       configArr = splitConfig(config);
     } else {
-      // if there is no seperator "|", regard config as pattern.
+      // if there is no separator "|", regard configuration as pattern.
       configArr = new String[3];
       configArr[0] = config;
     }
@@ -82,7 +84,7 @@ private void setConfigruations(String[] configArr) {
   }
 
   @Override
-  public String getFormattedItem(AccessLogParam accessLogParam) {
+  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
     SimpleDateFormat dateFormat = getDatetimeFormat();
     return dateFormat.format(new Date(accessLogParam.getStartMillisecond()));
   }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItem.java
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItem.java
index 4978e7fa0..88980a32a 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItem.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItem.java
@@ -20,9 +20,11 @@
 import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
 import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
 
-public class DurationMillisecondItem implements AccessLogItem {
+import io.vertx.ext.web.RoutingContext;
+
+public class DurationMillisecondItem implements AccessLogItem<RoutingContext> {
   @Override
-  public String getFormattedItem(AccessLogParam accessLogParam) {
+  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
     return String.valueOf(accessLogParam.getEndMillisecond() - accessLogParam.getStartMillisecond());
   }
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItem.java
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItem.java
index dfa352d5b..b8ec486b3 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItem.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItem.java
@@ -20,9 +20,11 @@
 import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
 import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
 
-public class DurationSecondItem implements AccessLogItem {
+import io.vertx.ext.web.RoutingContext;
+
+public class DurationSecondItem implements AccessLogItem<RoutingContext> {
   @Override
-  public String getFormattedItem(AccessLogParam accessLogParam) {
+  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
     return String.valueOf((accessLogParam.getEndMillisecond() - accessLogParam.getStartMillisecond())
/ 1000);
   }
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/PlainTextItem.java
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/PlainTextItem.java
index abf146072..fb7683f19 100644
--- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/PlainTextItem.java
+++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/PlainTextItem.java
@@ -20,10 +20,12 @@
 import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
 import org.apache.servicecomb.transport.rest.vertx.accesslog.element.AccessLogItem;
 
+import io.vertx.ext.web.RoutingContext;
+
 /**
  * Print content as it is.
  */
-public class PlainTextItem implements AccessLogItem {
+public class PlainTextItem implements AccessLogItem<RoutingContext> {
   private final String content;
 
   public PlainTextItem(String content) {
@@ -31,7 +33,7 @@ public PlainTextItem(String content) {
   }
 
   @Override
-  public String getFormattedItem(AccessLogParam accessLogParam) {
+  public String getFormattedItem(AccessLogParam<RoutingContext> accessLogParam) {
     return content;
   }
 }
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGeneratorTest.java
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGeneratorTest.java
index a70d6c101..a8a1186b1 100644
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGeneratorTest.java
+++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/AccessLogGeneratorTest.java
@@ -40,25 +40,20 @@
 
 public class AccessLogGeneratorTest {
 
-  private static final AccessLogItem methodElement = new HttpMethodItem();
-
-  private static final AccessLogItem datetimeElement = new DatetimeConfigurableItem();
-
-  private static final AccessLogItem plainTextElement = new PlainTextItem(" - ");
-
   private static final AccessLogGenerator ACCESS_LOG_GENERATOR = new AccessLogGenerator("%m
- %t",
       rawPattern -> {
         assertEquals("%m - %t", rawPattern);
         return Arrays.asList(
             new AccessLogItemLocation().setStart(0).setEnd(2).setPlaceHolder(AccessLogItemTypeEnum.HTTP_METHOD),
             new AccessLogItemLocation().setStart(2).setEnd(5).setPlaceHolder(AccessLogItemTypeEnum.TEXT_PLAIN),
-            new AccessLogItemLocation().setStart(5).setEnd(7)
+            new AccessLogItemLocation().setStart(5)
+                .setEnd(7)
                 .setPlaceHolder(AccessLogItemTypeEnum.DATETIME_DEFAULT));
       });
 
   @Test
   public void testConstructor() {
-    AccessLogItem[] elements = Deencapsulation.getField(ACCESS_LOG_GENERATOR, "accessLogItems");
+    AccessLogItem<RoutingContext>[] elements = Deencapsulation.getField(ACCESS_LOG_GENERATOR,
"accessLogItems");
     assertEquals(3, elements.length);
     assertEquals(HttpMethodItem.class, elements[0].getClass());
     assertEquals(PlainTextItem.class, elements[1].getClass());
@@ -83,4 +78,4 @@ public void testLog() {
 
     Assert.assertEquals("DELETE" + " - " + simpleDateFormat.format(startMillisecond), log);
   }
-}
\ No newline at end of file
+}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/AccessLogItemFactoryTest.java
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/AccessLogItemFactoryTest.java
index c98dfb410..94b16e225 100644
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/AccessLogItemFactoryTest.java
+++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/AccessLogItemFactoryTest.java
@@ -30,6 +30,8 @@
 import org.junit.Assert;
 import org.junit.Test;
 
+import io.vertx.ext.web.RoutingContext;
+
 public class AccessLogItemFactoryTest {
   private static final String PATTERN = "test %{EEE, dd MMM yyyy HH:mm:ss zzz}t cs-uri-query
cs-uri %{VARNAME1}i";
 
@@ -38,12 +40,12 @@
       new AccessLogItemLocation().setStart(5).setEnd(38).setPlaceHolder(AccessLogItemTypeEnum.DATETIME_CONFIGURABLE),
       new AccessLogItemLocation().setStart(39).setEnd(51).setPlaceHolder(AccessLogItemTypeEnum.QUERY_STRING),
       new AccessLogItemLocation().setStart(52).setEnd(58).setPlaceHolder(AccessLogItemTypeEnum.URL_PATH_WITH_QUERY),
-      new AccessLogItemLocation().setStart(59).setEnd(71).setPlaceHolder(AccessLogItemTypeEnum.REQUEST_HEADER)
-  );
+      new AccessLogItemLocation().setStart(59).setEnd(71).setPlaceHolder(AccessLogItemTypeEnum.REQUEST_HEADER));
 
   @Test
   public void testCreateAccessLogItem() {
-    List<AccessLogItem> itemList = new AccessLogItemFactory().createAccessLogItem(PATTERN,
locationList);
+    List<AccessLogItem<RoutingContext>> itemList =
+        new AccessLogItemFactory().createAccessLogItem(PATTERN, locationList);
     Assert.assertEquals(5, itemList.size());
     Assert.assertEquals(PlainTextItem.class, itemList.get(0).getClass());
     Assert.assertEquals(DatetimeConfigurableItem.class, itemList.get(1).getClass());
@@ -51,4 +53,4 @@ public void testCreateAccessLogItem() {
     Assert.assertEquals(UrlPathWithQueryItem.class, itemList.get(3).getClass());
     Assert.assertEquals(RequestHeaderItem.class, itemList.get(4).getClass());
   }
-}
\ No newline at end of file
+}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/PercentagePrefixConfigurableItemCreatorTest.java
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/PercentagePrefixConfigurableItemCreatorTest.java
index bdde3efec..b89b459dc 100644
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/PercentagePrefixConfigurableItemCreatorTest.java
+++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/creator/PercentagePrefixConfigurableItemCreatorTest.java
@@ -28,6 +28,8 @@
 import org.junit.Assert;
 import org.junit.Test;
 
+import io.vertx.ext.web.RoutingContext;
+
 public class PercentagePrefixConfigurableItemCreatorTest {
   private static final String PATTERN = "test %{EEE, dd MMM yyyy HH:mm:ss zzz}t %{VARNAME1}i
%{VARNAME2}o %{VARNAME3}C";
 
@@ -38,7 +40,7 @@ public void testCreateDatetimeConfigurableItem() {
     AccessLogItemLocation location = new AccessLogItemLocation().setStart(5).setEnd(38).setPlaceHolder(
         AccessLogItemTypeEnum.DATETIME_CONFIGURABLE);
 
-    AccessLogItem item = CREATOR.create(PATTERN, location);
+    AccessLogItem<RoutingContext> item = CREATOR.create(PATTERN, location);
 
     Assert.assertEquals(DatetimeConfigurableItem.class, item.getClass());
     Assert.assertEquals("EEE, dd MMM yyyy HH:mm:ss zzz", ((DatetimeConfigurableItem) item).getPattern());
@@ -49,7 +51,7 @@ public void testCreateRequestHeaderItem() {
     AccessLogItemLocation location = new AccessLogItemLocation().setStart(39).setEnd(51).setPlaceHolder(
         AccessLogItemTypeEnum.REQUEST_HEADER);
 
-    AccessLogItem item = CREATOR.create(PATTERN, location);
+    AccessLogItem<RoutingContext> item = CREATOR.create(PATTERN, location);
 
     Assert.assertEquals(RequestHeaderItem.class, item.getClass());
     Assert.assertEquals("VARNAME1", ((RequestHeaderItem) item).getVarName());
@@ -61,7 +63,7 @@ public void testCreateResponseHeaderItem() {
     AccessLogItemLocation location = new AccessLogItemLocation().setStart(52).setEnd(64).setPlaceHolder(
         AccessLogItemTypeEnum.RESPONSE_HEADER);
 
-    AccessLogItem item = CREATOR.create(PATTERN, location);
+    AccessLogItem<RoutingContext> item = CREATOR.create(PATTERN, location);
 
     Assert.assertEquals(ResponseHeaderItem.class, item.getClass());
     Assert.assertEquals("VARNAME2", ((ResponseHeaderItem) item).getVarName());
@@ -72,7 +74,7 @@ public void testCreateCookieItem() {
     AccessLogItemLocation location = new AccessLogItemLocation().setStart(65).setEnd(77).setPlaceHolder(
         AccessLogItemTypeEnum.COOKIE);
 
-    AccessLogItem item = CREATOR.create(PATTERN, location);
+    AccessLogItem<RoutingContext> item = CREATOR.create(PATTERN, location);
 
     Assert.assertEquals(CookieItem.class, item.getClass());
     Assert.assertEquals("VARNAME3", ((CookieItem) item).getVarName());
@@ -80,12 +82,13 @@ public void testCreateCookieItem() {
 
   @Test
   public void testPlainTextItem() {
-    AccessLogItemLocation location = new AccessLogItemLocation().setStart(0).setEnd(5)
+    AccessLogItemLocation location = new AccessLogItemLocation().setStart(0)
+        .setEnd(5)
         .setPlaceHolder(AccessLogItemTypeEnum.TEXT_PLAIN);
 
-    AccessLogItem item = CREATOR.create(PATTERN, location);
+    AccessLogItem<RoutingContext> item = CREATOR.create(PATTERN, location);
 
     Assert.assertEquals(PlainTextItem.class, item.getClass());
     Assert.assertEquals("test ", ((PlainTextItem) item).getFormattedItem(null));
   }
-}
\ No newline at end of file
+}
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItemTest.java
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItemTest.java
index f9945cec9..17876efc6 100644
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItemTest.java
+++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DatetimeConfigurableItemTest.java
@@ -26,6 +26,8 @@
 import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
 import org.junit.Test;
 
+import io.vertx.ext.web.RoutingContext;
+
 public class DatetimeConfigurableItemTest {
 
   private static final long START_MILLISECOND = 1416863450581L;
@@ -35,7 +37,8 @@ public void getFormattedElement() {
     DatetimeConfigurableItem element = new DatetimeConfigurableItem(
         "EEE, yyyy MMM dd HH:mm:ss zzz|GMT-08|zh-CN");
 
-    AccessLogParam accessLogParam = new AccessLogParam().setStartMillisecond(START_MILLISECOND);
+    AccessLogParam<RoutingContext> accessLogParam =
+        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
 
     String result = element.getFormattedItem(accessLogParam);
 
@@ -47,7 +50,8 @@ public void getFormattedElementOnNoPattern() {
     DatetimeConfigurableItem element = new DatetimeConfigurableItem(
         "|GMT+08|zh-CN");
 
-    AccessLogParam accessLogParam = new AccessLogParam().setStartMillisecond(START_MILLISECOND);
+    AccessLogParam<RoutingContext> accessLogParam =
+        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
 
     String result = element.getFormattedItem(accessLogParam);
 
@@ -61,7 +65,8 @@ public void getFormattedElementOnNoTimezone() {
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd zzz", Locale.forLanguageTag("zh-CN"));
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
 
-    AccessLogParam accessLogParam = new AccessLogParam().setStartMillisecond(START_MILLISECOND);
+    AccessLogParam<RoutingContext> accessLogParam =
+        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
 
     String result = element.getFormattedItem(accessLogParam);
 
@@ -73,7 +78,8 @@ public void getFormattedElementOnNoLocale() {
     DatetimeConfigurableItem element = new DatetimeConfigurableItem(
         "EEE, dd MMM yyyy HH:mm:ss zzz|GMT+08|");
 
-    AccessLogParam accessLogParam = new AccessLogParam().setStartMillisecond(START_MILLISECOND);
+    AccessLogParam<RoutingContext> accessLogParam =
+        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
 
     String result = element.getFormattedItem(accessLogParam);
 
@@ -87,7 +93,8 @@ public void getFormattedElementOnNoConfig() {
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DatetimeConfigurableItem.DEFAULT_DATETIME_PATTERN,
         Locale.US);
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
-    AccessLogParam accessLogParam = new AccessLogParam().setStartMillisecond(START_MILLISECOND);
+    AccessLogParam<RoutingContext> accessLogParam =
+        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
 
     String result = element.getFormattedItem(accessLogParam);
 
@@ -99,7 +106,8 @@ public void testConstructorWithNoArg() {
     DatetimeConfigurableItem element = new DatetimeConfigurableItem();
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz",
Locale.US);
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
-    AccessLogParam accessLogParam = new AccessLogParam().setStartMillisecond(START_MILLISECOND);
+    AccessLogParam<RoutingContext> accessLogParam =
+        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
 
     String result = element.getFormattedItem(accessLogParam);
 
@@ -114,7 +122,8 @@ public void testConstructorWithNoSeparator() {
     DatetimeConfigurableItem element = new DatetimeConfigurableItem("yyyy/MM/dd HH:mm:ss
zzz");
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss zzz", Locale.US);
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
-    AccessLogParam accessLogParam = new AccessLogParam().setStartMillisecond(START_MILLISECOND);
+    AccessLogParam<RoutingContext> accessLogParam =
+        new AccessLogParam<RoutingContext>().setStartMillisecond(START_MILLISECOND);
 
     String result = element.getFormattedItem(accessLogParam);
 
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItemTest.java
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItemTest.java
index ac3283f81..88e18f018 100644
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItemTest.java
+++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationMillisecondItemTest.java
@@ -22,13 +22,16 @@
 import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
 import org.junit.Test;
 
+import io.vertx.ext.web.RoutingContext;
+
 public class DurationMillisecondItemTest {
 
   public static final DurationMillisecondItem ELEMENT = new DurationMillisecondItem();
 
   @Test
   public void getFormattedElement() {
-    AccessLogParam param = new AccessLogParam().setStartMillisecond(1L).setEndMillisecond(2L);
+    AccessLogParam<RoutingContext> param =
+        new AccessLogParam<RoutingContext>().setStartMillisecond(1L).setEndMillisecond(2L);
 
     String result = ELEMENT.getFormattedItem(param);
 
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItemTest.java
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItemTest.java
index f25d53fb9..6f99e4752 100644
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItemTest.java
+++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/element/impl/DurationSecondItemTest.java
@@ -22,13 +22,16 @@
 import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogParam;
 import org.junit.Test;
 
+import io.vertx.ext.web.RoutingContext;
+
 public class DurationSecondItemTest {
 
   public static final DurationSecondItem ELEMENT = new DurationSecondItem();
 
   @Test
   public void getFormattedElementOn999ms() {
-    AccessLogParam param = new AccessLogParam().setStartMillisecond(1L).setEndMillisecond(1000L);
+    AccessLogParam<RoutingContext> param =
+        new AccessLogParam<RoutingContext>().setStartMillisecond(1L).setEndMillisecond(1000L);
 
     String result = ELEMENT.getFormattedItem(param);
 
@@ -37,7 +40,8 @@ public void getFormattedElementOn999ms() {
 
   @Test
   public void getFormattedElementOn1000ms() {
-    AccessLogParam param = new AccessLogParam().setStartMillisecond(1L).setEndMillisecond(1001L);
+    AccessLogParam<RoutingContext> param =
+        new AccessLogParam<RoutingContext>().setStartMillisecond(1L).setEndMillisecond(1001L);
 
     String result = ELEMENT.getFormattedItem(param);
 
@@ -46,7 +50,8 @@ public void getFormattedElementOn1000ms() {
 
   @Test
   public void getFormattedElementOn1001ms() {
-    AccessLogParam param = new AccessLogParam().setStartMillisecond(1L).setEndMillisecond(1002L);
+    AccessLogParam<RoutingContext> param =
+        new AccessLogParam<RoutingContext>().setStartMillisecond(1L).setEndMillisecond(1002L);
 
     String result = ELEMENT.getFormattedItem(param);
 
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/DefaultAccessLogPatternParserTest.java
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/DefaultAccessLogPatternParserTest.java
index 1ca15fdc7..4fda276ea 100644
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/DefaultAccessLogPatternParserTest.java
+++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/impl/DefaultAccessLogPatternParserTest.java
@@ -45,7 +45,6 @@
   private static DefaultAccessLogPatternParser accessLogPatternParser = new DefaultAccessLogPatternParser();
 
   @Test
-  @SuppressWarnings(value = "unchecked")
   public void testParsePattern() {
     List<AccessLogItemLocation> result = accessLogPatternParser.parsePattern(ROW_PATTERN);
     assertEquals(27, result.size());
diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/matcher/SimpleItemMatcherTest.java
b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/matcher/SimpleItemMatcherTest.java
index 474e67088..3ce57ae16 100644
--- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/matcher/SimpleItemMatcherTest.java
+++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/accesslog/parser/matcher/SimpleItemMatcherTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.servicecomb.transport.rest.vertx.accesslog.parser.matcher;
 
-import org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogConfiguration;
 import org.apache.servicecomb.transport.rest.vertx.accesslog.parser.AccessLogItemLocation;
 import org.apache.servicecomb.transport.rest.vertx.accesslog.placeholder.AccessLogItemTypeEnum;
 import org.junit.Assert;
@@ -56,4 +55,4 @@ public void testNotMatch() {
     AccessLogItemLocation location = MATCHER.match("notmatch", 0);
     Assert.assertNull(location);
   }
-}
\ No newline at end of file
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message