This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 6b012b64c upgrade 2-advanced/dubbo-samples-notify to jdk17 and spring3
(#1059)
6b012b64c is described below
commit 6b012b64ca250fb84866d59cf70f8853669c9150
Author: hhuang <[email protected]>
AuthorDate: Mon Mar 18 10:13:08 2024 +0800
upgrade 2-advanced/dubbo-samples-notify to jdk17 and spring3 (#1059)
---
2-advanced/dubbo-samples-notify/case-versions.conf | 4 +-
.../dubbo-samples-notify-consumer/pom.xml | 10 +---
.../apache/dubbo/samples/notify/consumer/Task.java | 3 +-
.../dubbo/samples/notify/consumer/NotifyIT.java | 20 +++----
.../dubbo-samples-notify-provider/pom.xml | 12 +---
.../samples/notify/provider/DemoServiceImpl.java | 1 -
2-advanced/dubbo-samples-notify/pom.xml | 67 +++++++++-------------
7 files changed, 42 insertions(+), 75 deletions(-)
diff --git a/2-advanced/dubbo-samples-notify/case-versions.conf
b/2-advanced/dubbo-samples-notify/case-versions.conf
index b03fb1ae4..97d0c905e 100644
--- a/2-advanced/dubbo-samples-notify/case-versions.conf
+++ b/2-advanced/dubbo-samples-notify/case-versions.conf
@@ -21,5 +21,5 @@
# Spring app
dubbo.version=3.*
-spring.version=4.*, 5.*
-java.version= [>= 8]
+spring.version=6.*
+java.version= [>= 17]
diff --git
a/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/pom.xml
b/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/pom.xml
index 1023776b0..00ec10e32 100644
--- a/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/pom.xml
+++ b/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/pom.xml
@@ -38,8 +38,7 @@
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper-curator5</artifactId>
- <type>pom</type>
+
<artifactId>dubbo-zookeeper-curator5-spring-boot-starter</artifactId>
</dependency>
<!-- spring starter -->
@@ -65,13 +64,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
diff --git
a/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/src/main/java/org/apache/dubbo/samples/notify/consumer/Task.java
b/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/src/main/java/org/apache/dubbo/samples/notify/consumer/Task.java
index 9686fe54a..83d10d50e 100644
---
a/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/src/main/java/org/apache/dubbo/samples/notify/consumer/Task.java
+++
b/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/src/main/java/org/apache/dubbo/samples/notify/consumer/Task.java
@@ -25,10 +25,9 @@ import
org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
-// @Component
+@Component
public class Task implements CommandLineRunner {
- // @DubboReference
@DubboReference(methods = @Method(name = "sayHello", onreturn =
"notify.onReturn", onthrow = "notify.onThrow"))
private DemoService demoService;
diff --git
a/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/src/test/java/org/apache/dubbo/samples/notify/consumer/NotifyIT.java
b/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/src/test/java/org/apache/dubbo/samples/notify/consumer/NotifyIT.java
index 04f71948a..18d3d37b1 100644
---
a/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/src/test/java/org/apache/dubbo/samples/notify/consumer/NotifyIT.java
+++
b/2-advanced/dubbo-samples-notify/dubbo-samples-notify-consumer/src/test/java/org/apache/dubbo/samples/notify/consumer/NotifyIT.java
@@ -20,18 +20,14 @@ package org.apache.dubbo.samples.notify.consumer;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.Method;
import org.apache.dubbo.samples.notify.DemoService;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest
-@RunWith(SpringRunner.class)
public class NotifyIT {
- // @DubboReference
+
@DubboReference(timeout = 6000, methods = @Method(name = "sayHello",
onreturn = "notify.onReturn", onthrow = "notify.onThrow"))
private DemoService demoService;
@@ -39,9 +35,9 @@ public class NotifyIT {
private NotifyImpl notify;
@Test
- public void testDemoService() throws Exception {
+ public void testDemoService() {
String result = demoService.sayHello(1);
- Assert.assertEquals("demo1", result);
+ Assertions.assertEquals("demo1", result);
}
@Test
@@ -56,7 +52,7 @@ public class NotifyIT {
}
}
- Assert.assertEquals("demo2", notify.ret.get(id));
+ Assertions.assertEquals("demo2", notify.ret.get(id));
}
@Test
@@ -76,8 +72,8 @@ public class NotifyIT {
}
}
- Assert.assertTrue(notify.ret.get(id) instanceof RuntimeException);
+ Assertions.assertTrue(notify.ret.get(id) instanceof RuntimeException);
Exception e = (Exception) notify.ret.get(id);
- Assert.assertEquals("exception from sayHello: too large id",
e.getMessage());
+ Assertions.assertEquals("exception from sayHello: too large id",
e.getMessage());
}
}
diff --git
a/2-advanced/dubbo-samples-notify/dubbo-samples-notify-provider/pom.xml
b/2-advanced/dubbo-samples-notify/dubbo-samples-notify-provider/pom.xml
index 0e125fd07..04d92d5cb 100644
--- a/2-advanced/dubbo-samples-notify/dubbo-samples-notify-provider/pom.xml
+++ b/2-advanced/dubbo-samples-notify/dubbo-samples-notify-provider/pom.xml
@@ -39,8 +39,7 @@
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper-curator5</artifactId>
- <type>pom</type>
+
<artifactId>dubbo-zookeeper-curator5-spring-boot-starter</artifactId>
</dependency>
<!-- spring starter -->
@@ -59,14 +58,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git
a/2-advanced/dubbo-samples-notify/dubbo-samples-notify-provider/src/main/java/org/apache/dubbo/samples/notify/provider/DemoServiceImpl.java
b/2-advanced/dubbo-samples-notify/dubbo-samples-notify-provider/src/main/java/org/apache/dubbo/samples/notify/provider/DemoServiceImpl.java
index 02d207900..33d879bff 100644
---
a/2-advanced/dubbo-samples-notify/dubbo-samples-notify-provider/src/main/java/org/apache/dubbo/samples/notify/provider/DemoServiceImpl.java
+++
b/2-advanced/dubbo-samples-notify/dubbo-samples-notify-provider/src/main/java/org/apache/dubbo/samples/notify/provider/DemoServiceImpl.java
@@ -18,7 +18,6 @@
package org.apache.dubbo.samples.notify.provider;
import org.apache.dubbo.config.annotation.DubboService;
-import org.apache.dubbo.config.annotation.Method;
import org.apache.dubbo.samples.notify.DemoService;
@DubboService
diff --git a/2-advanced/dubbo-samples-notify/pom.xml
b/2-advanced/dubbo-samples-notify/pom.xml
index 97685de76..2368af447 100644
--- a/2-advanced/dubbo-samples-notify/pom.xml
+++ b/2-advanced/dubbo-samples-notify/pom.xml
@@ -36,13 +36,14 @@
<description>Dubbo Samples Notify</description>
<properties>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
+ <maven.compiler.source>17</maven.compiler.source>
+ <maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dubbo.version>3.2.6</dubbo.version>
- <spring-boot.version>2.7.8</spring-boot.version>
- <junit.version>4.13.1</junit.version>
+ <spring-boot.version>3.2.3</spring-boot.version>
+
+ <junit5.version>5.10.1</junit5.version>
</properties>
<modules>
@@ -61,7 +62,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
-
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
@@ -73,7 +73,6 @@
</exclusion>
</exclusions>
</dependency>
-
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-bom</artifactId>
@@ -82,44 +81,27 @@
<scope>import</scope>
</dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper-curator5</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
- <exclusions>
- <exclusion>
- <artifactId>logback-classic</artifactId>
- <groupId>ch.qos.logback</groupId>
- </exclusion>
- <exclusion>
- <artifactId>logback-core</artifactId>
- <groupId>ch.qos.logback</groupId>
- </exclusion>
- <exclusion>
- <artifactId>log4j</artifactId>
- <groupId>log4j</groupId>
- </exclusion>
- <exclusion>
- <artifactId>slf4j-log4j12</artifactId>
- <groupId>org.slf4j</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</dependencyManagement>
<dependencies>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>${junit5.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit5.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
+ <version>${junit5.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -131,6 +113,13 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
</pluginManagement>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]