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

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
     new 6eeb3373f [SCB-2474](task 2) Java17 Test paas on providers and common 
module (#2818)
6eeb3373f is described below

commit 6eeb3373f7c9131d0eafd449326d0a51dd08fadc
Author: ZhangJian He <[email protected]>
AuthorDate: Thu May 5 15:57:08 2022 +0800

    [SCB-2474](task 2) Java17 Test paas on providers and common module (#2818)
---
 .../element/impl/DatetimeConfigurableItemTest.java | 89 ++++++++++++----------
 common/common-protobuf/pom.xml                     |  5 ++
 .../internal/schema/TestRepeatedSchema.java        |  4 +-
 providers/provider-pojo/pom.xml                    | 10 ++-
 providers/provider-springmvc/pom.xml               | 22 +++---
 .../src/test/resources/log4j2.xml                  | 30 ++++++++
 6 files changed, 104 insertions(+), 56 deletions(-)

diff --git 
a/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/DatetimeConfigurableItemTest.java
 
b/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/DatetimeConfigurableItemTest.java
index c46e803a1..fb1548ed2 100644
--- 
a/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/DatetimeConfigurableItemTest.java
+++ 
b/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/DatetimeConfigurableItemTest.java
@@ -28,8 +28,11 @@ import org.apache.servicecomb.core.Invocation;
 import org.apache.servicecomb.core.event.InvocationFinishEvent;
 import org.apache.servicecomb.core.event.ServerAccessLogEvent;
 import org.apache.servicecomb.core.invocation.InvocationStageTrace;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledOnOs;
+import org.junit.jupiter.api.condition.OS;
 import org.mockito.Mockito;
 
 public class DatetimeConfigurableItemTest {
@@ -46,7 +49,7 @@ public class DatetimeConfigurableItemTest {
 
   private InvocationStageTrace invocationStageTrace;
 
-  @Before
+  @BeforeEach
   public void initStrBuilder() {
     finishEvent = Mockito.mock(InvocationFinishEvent.class);
     invocation = Mockito.mock(Invocation.class);
@@ -64,101 +67,105 @@ public class DatetimeConfigurableItemTest {
   }
 
   @Test
+  @EnabledOnOs({OS.LINUX, OS.WINDOWS})
   public void serverFormattedElement() {
     ConfigurableDatetimeAccessItem element = new 
ConfigurableDatetimeAccessItem(
-        "EEE, yyyy MMM dd HH:mm:ss zzz|GMT-08|zh-CN");
+            "EEE, yyyy MMM dd HH:mm:ss zzz|GMT-08|zh-CN");
     element.appendServerFormattedItem(accessLogEvent, strBuilder);
-    assertEquals("星期一, 2014 十一月 24 13:10:50 GMT-08:00", strBuilder.toString());
+    Assertions.assertEquals("星期一, 2014 十一月 24 13:10:50 GMT-08:00", 
strBuilder.toString());
   }
 
   @Test
+  @EnabledOnOs({OS.LINUX, OS.WINDOWS})
   public void clientFormattedElement() {
     ConfigurableDatetimeAccessItem element = new 
ConfigurableDatetimeAccessItem(
-        "EEE, yyyy MMM dd HH:mm:ss zzz|GMT-08|zh-CN");
+            "EEE, yyyy MMM dd HH:mm:ss zzz|GMT-08|zh-CN");
     element.appendClientFormattedItem(finishEvent, strBuilder);
-    assertEquals("星期一, 2014 十一月 24 13:10:50 GMT-08:00", strBuilder.toString());
+    Assertions.assertEquals("星期一, 2014 十一月 24 13:10:50 GMT-08:00", 
strBuilder.toString());
   }
 
   @Test
+  @EnabledOnOs({OS.LINUX, OS.WINDOWS})
   public void serverFormattedElementOnNoPattern() {
     ConfigurableDatetimeAccessItem element = new 
ConfigurableDatetimeAccessItem(
-        "|GMT+08|zh-CN");
+            "|GMT+08|zh-CN");
 
     element.appendServerFormattedItem(accessLogEvent, strBuilder);
-    assertEquals("星期二, 25 十一月 2014 05:10:50 GMT+08:00", strBuilder.toString());
+    Assertions.assertEquals("星期二, 25 十一月 2014 05:10:50 GMT+08:00", 
strBuilder.toString());
   }
 
   @Test
+  @EnabledOnOs({OS.LINUX, OS.WINDOWS})
   public void clientFormattedElementOnNoPattern() {
     ConfigurableDatetimeAccessItem element = new 
ConfigurableDatetimeAccessItem(
-        "|GMT+08|zh-CN");
+            "|GMT+08|zh-CN");
 
     element.appendClientFormattedItem(finishEvent, strBuilder);
-    assertEquals("星期二, 25 十一月 2014 05:10:50 GMT+08:00", strBuilder.toString());
+    Assertions.assertEquals("星期二, 25 十一月 2014 05:10:50 GMT+08:00", 
strBuilder.toString());
   }
 
   @Test
   public void getFormattedElementOnNoTimezone() {
     ConfigurableDatetimeAccessItem element = new 
ConfigurableDatetimeAccessItem(
-        "yyyy/MM/dd zzz||zh-CN");
+            "yyyy/MM/dd zzz||zh-CN");
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd zzz", 
Locale.forLanguageTag("zh-CN"));
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
 
     element.appendServerFormattedItem(accessLogEvent, strBuilder);
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
+    Assertions.assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
   }
 
   @Test
   public void clientFormattedElementOnNoTimezone() {
     ConfigurableDatetimeAccessItem element = new 
ConfigurableDatetimeAccessItem(
-        "yyyy/MM/dd zzz||zh-CN");
+            "yyyy/MM/dd zzz||zh-CN");
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd zzz", 
Locale.forLanguageTag("zh-CN"));
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
 
     element.appendClientFormattedItem(finishEvent, strBuilder);
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
+    Assertions.assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
   }
 
   @Test
   public void serverFormattedElementOnNoLocale() {
     ConfigurableDatetimeAccessItem element = new 
ConfigurableDatetimeAccessItem(
-        "EEE, dd MMM yyyy HH:mm:ss zzz|GMT+08|");
+            "EEE, dd MMM yyyy HH:mm:ss zzz|GMT+08|");
 
     element.appendServerFormattedItem(accessLogEvent, strBuilder);
-    assertEquals("Tue, 25 Nov 2014 05:10:50 GMT+08:00", strBuilder.toString());
+    Assertions.assertEquals("Tue, 25 Nov 2014 05:10:50 GMT+08:00", 
strBuilder.toString());
   }
 
   @Test
   public void clientFormattedElementOnNoLocale() {
     ConfigurableDatetimeAccessItem element = new 
ConfigurableDatetimeAccessItem(
-        "EEE, dd MMM yyyy HH:mm:ss zzz|GMT+08|");
+            "EEE, dd MMM yyyy HH:mm:ss zzz|GMT+08|");
 
     element.appendClientFormattedItem(finishEvent, strBuilder);
-    assertEquals("Tue, 25 Nov 2014 05:10:50 GMT+08:00", strBuilder.toString());
+    Assertions.assertEquals("Tue, 25 Nov 2014 05:10:50 GMT+08:00", 
strBuilder.toString());
   }
 
   @Test
   public void serverFormattedElementOnNoConfig() {
     ConfigurableDatetimeAccessItem element = new 
ConfigurableDatetimeAccessItem(
-        "||");
+            "||");
     SimpleDateFormat simpleDateFormat = new 
SimpleDateFormat(ConfigurableDatetimeAccessItem.DEFAULT_DATETIME_PATTERN,
-        Locale.US);
+            Locale.US);
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
 
     element.appendServerFormattedItem(accessLogEvent, strBuilder);
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
+    Assertions.assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
   }
 
   @Test
   public void clientFormattedElementOnNoConfig() {
     ConfigurableDatetimeAccessItem element = new 
ConfigurableDatetimeAccessItem(
-        "||");
+            "||");
     SimpleDateFormat simpleDateFormat = new 
SimpleDateFormat(ConfigurableDatetimeAccessItem.DEFAULT_DATETIME_PATTERN,
-        Locale.US);
+            Locale.US);
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
 
     element.appendClientFormattedItem(finishEvent, strBuilder);
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
+    Assertions.assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
   }
 
   @Test
@@ -168,10 +175,10 @@ public class DatetimeConfigurableItemTest {
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
 
     element.appendServerFormattedItem(accessLogEvent, strBuilder);
-    assertEquals("EEE, dd MMM yyyy HH:mm:ss zzz", element.getPattern());
-    assertEquals(Locale.US, element.getLocale());
-    assertEquals(TimeZone.getDefault(), element.getTimezone());
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
+    Assertions.assertEquals("EEE, dd MMM yyyy HH:mm:ss zzz", 
element.getPattern());
+    Assertions.assertEquals(Locale.US, element.getLocale());
+    Assertions.assertEquals(TimeZone.getDefault(), element.getTimezone());
+    Assertions.assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
   }
 
   @Test
@@ -181,10 +188,10 @@ public class DatetimeConfigurableItemTest {
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
 
     element.appendClientFormattedItem(finishEvent, strBuilder);
-    assertEquals("EEE, dd MMM yyyy HH:mm:ss zzz", element.getPattern());
-    assertEquals(Locale.US, element.getLocale());
-    assertEquals(TimeZone.getDefault(), element.getTimezone());
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
+    Assertions.assertEquals("EEE, dd MMM yyyy HH:mm:ss zzz", 
element.getPattern());
+    Assertions.assertEquals(Locale.US, element.getLocale());
+    Assertions.assertEquals(TimeZone.getDefault(), element.getTimezone());
+    Assertions.assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
   }
 
   @Test
@@ -194,10 +201,10 @@ public class DatetimeConfigurableItemTest {
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
 
     element.appendServerFormattedItem(accessLogEvent, strBuilder);
-    assertEquals("yyyy/MM/dd HH:mm:ss zzz", element.getPattern());
-    assertEquals(Locale.US, element.getLocale());
-    assertEquals(TimeZone.getDefault(), element.getTimezone());
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
+    Assertions.assertEquals("yyyy/MM/dd HH:mm:ss zzz", element.getPattern());
+    Assertions.assertEquals(Locale.US, element.getLocale());
+    Assertions.assertEquals(TimeZone.getDefault(), element.getTimezone());
+    Assertions.assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
   }
 
   @Test
@@ -207,9 +214,9 @@ public class DatetimeConfigurableItemTest {
     simpleDateFormat.setTimeZone(TimeZone.getDefault());
 
     element.appendClientFormattedItem(finishEvent, strBuilder);
-    assertEquals("yyyy/MM/dd HH:mm:ss zzz", element.getPattern());
-    assertEquals(Locale.US, element.getLocale());
-    assertEquals(TimeZone.getDefault(), element.getTimezone());
-    assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
+    Assertions.assertEquals("yyyy/MM/dd HH:mm:ss zzz", element.getPattern());
+    Assertions.assertEquals(Locale.US, element.getLocale());
+    Assertions.assertEquals(TimeZone.getDefault(), element.getTimezone());
+    Assertions.assertEquals(simpleDateFormat.format(START_MILLISECOND), 
strBuilder.toString());
   }
 }
diff --git a/common/common-protobuf/pom.xml b/common/common-protobuf/pom.xml
index 7fdf1910e..806855fd0 100644
--- a/common/common-protobuf/pom.xml
+++ b/common/common-protobuf/pom.xml
@@ -60,5 +60,10 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>foundation-test-scaffolding</artifactId>
     </dependency>
+    <dependency>
+      <groupId>javax.xml.bind</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 </project>
diff --git 
a/foundations/foundation-protobuf/src/test/java/org/apache/servicecomb/foundation/protobuf/internal/schema/TestRepeatedSchema.java
 
b/foundations/foundation-protobuf/src/test/java/org/apache/servicecomb/foundation/protobuf/internal/schema/TestRepeatedSchema.java
index c5b9019c3..9ce2a742d 100644
--- 
a/foundations/foundation-protobuf/src/test/java/org/apache/servicecomb/foundation/protobuf/internal/schema/TestRepeatedSchema.java
+++ 
b/foundations/foundation-protobuf/src/test/java/org/apache/servicecomb/foundation/protobuf/internal/schema/TestRepeatedSchema.java
@@ -213,7 +213,7 @@ public class TestRepeatedSchema extends TestSchemaBase {
     check();
 
     RootWithArray rootWithArray = new RootWithArray();
-    rootWithArray.bytess = (byte[][]) sList.toArray();
+    rootWithArray.bytess = sList.toArray(new byte[0][]);
     Assert.assertArrayEquals(protobufBytes, 
rootSerializer.serialize(rootWithArray));
   }
 
@@ -224,7 +224,7 @@ public class TestRepeatedSchema extends TestSchemaBase {
     check();
 
     RootWithArray rootWithArray = new RootWithArray();
-    rootWithArray.strings = (String[]) sList.toArray();
+    rootWithArray.strings = sList.toArray(new String[0]);
     Assert.assertArrayEquals(protobufBytes, 
rootSerializer.serialize(rootWithArray));
   }
 
diff --git a/providers/provider-pojo/pom.xml b/providers/provider-pojo/pom.xml
index 81060cd2c..3e59e5192 100644
--- a/providers/provider-pojo/pom.xml
+++ b/providers/provider-pojo/pom.xml
@@ -30,6 +30,11 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>java-chassis-core</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-test-scaffolding</artifactId>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>registry-local</artifactId>
@@ -46,8 +51,9 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.servicecomb</groupId>
-      <artifactId>foundation-test-scaffolding</artifactId>
+      <groupId>javax.xml.bind</groupId>
+      <artifactId>jaxb-api</artifactId>
+      <scope>test</scope>
     </dependency>
   </dependencies>
 </project>
diff --git a/providers/provider-springmvc/pom.xml 
b/providers/provider-springmvc/pom.xml
index 28e252154..4016c21a6 100644
--- a/providers/provider-springmvc/pom.xml
+++ b/providers/provider-springmvc/pom.xml
@@ -17,8 +17,8 @@
   -->
 
 <project
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";
-  xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";
+        xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.servicecomb</groupId>
@@ -46,24 +46,24 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>swagger-generator-springmvc</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.servicecomb</groupId>
-      <artifactId>foundation-test-scaffolding</artifactId>
-      <scope>test</scope>
-    </dependency>
     <!-- compile CseHttpMessageConverter need this one .-->
     <dependency>
       <groupId>com.google.code.findbugs</groupId>
       <artifactId>jsr305</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-test-scaffolding</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
+      <groupId>javax.xml.bind</groupId>
+      <artifactId>jaxb-api</artifactId>
       <scope>test</scope>
     </dependency>
   </dependencies>
diff --git a/providers/provider-springmvc/src/test/resources/log4j2.xml 
b/providers/provider-springmvc/src/test/resources/log4j2.xml
new file mode 100644
index 000000000..00732c008
--- /dev/null
+++ b/providers/provider-springmvc/src/test/resources/log4j2.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<Configuration status="INFO">
+    <Appenders>
+        <Console name="Console" target="SYSTEM_OUT">
+            <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n" />
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Root level="warn">
+            <AppenderRef ref="Console" />
+        </Root>
+        <Logger name="org.apache.bookkeeper" level="info"/>
+    </Loggers>
+</Configuration>

Reply via email to