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 583c3bfce Upgrade mock samples (#1052)
583c3bfce is described below
commit 583c3bfce13254e3e3beaf5b5960fdcc6720cd3a
Author: huazhongming <[email protected]>
AuthorDate: Wed Mar 13 16:18:34 2024 +0800
Upgrade mock samples (#1052)
Signed-off-by: crazyhzm <[email protected]>
---
2-advanced/dubbo-samples-mock/case-versions.conf | 6 +-
.../dubbo-samples-mock-consumer/pom.xml | 74 +++++
.../dubbo/samples/mock/api/DemoServiceMock.java | 4 +-
.../samples/mock/consumer/ConsumerApplication.java | 31 +++
.../apache/dubbo/samples/mock/consumer/Task.java | 48 ++++
.../src/main/resources/application.yml | 21 ++
.../apache/dubbo/samples/mock/MockServicesIT.java | 22 +-
.../dubbo-samples-mock-interface/pom.xml | 38 +++
.../apache/dubbo/samples/mock/api/DemoService.java | 0
.../dubbo-samples-mock-provider/pom.xml | 70 +++++
.../samples/mock/provider}/DemoServiceImpl.java | 4 +-
.../samples/mock/provider/ProviderApplication.java | 31 +++
.../src/main/resources/application.yml | 24 ++
2-advanced/dubbo-samples-mock/pom.xml | 142 +++-------
.../apache/dubbo/samples/mock/MockConsumer.java | 36 ---
.../apache/dubbo/samples/mock/MockProvider.java | 35 ---
.../apache/dubbo/samples/mock/zk/Configurator.java | 62 -----
.../dubbo/samples/mock/zk/EmbeddedZooKeeper.java | 309 ---------------------
.../src/main/resources/log4j2.xml | 29 --
.../src/main/resources/spring/mock-consumer.xml | 36 ---
.../src/main/resources/spring/mock-provider.xml | 41 ---
2-advanced/pom.xml | 2 +-
22 files changed, 403 insertions(+), 662 deletions(-)
diff --git a/2-advanced/dubbo-samples-mock/case-versions.conf
b/2-advanced/dubbo-samples-mock/case-versions.conf
index f7373a530..8541de4fa 100644
--- a/2-advanced/dubbo-samples-mock/case-versions.conf
+++ b/2-advanced/dubbo-samples-mock/case-versions.conf
@@ -20,6 +20,6 @@
# Supported component versions of the test case
# Spring app
-dubbo.version=2.7*, 3.*
-spring.version=4.*, 5.*
-java.version= [>= 8]
+dubbo.version=3.3.*
+spring.version=6.*
+java.version= [ >= 17]
diff --git a/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/pom.xml
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/pom.xml
new file mode 100644
index 000000000..ff9c1925f
--- /dev/null
+++ b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/pom.xml
@@ -0,0 +1,74 @@
+<?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.
+ -->
+
+<project 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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-samples-mock</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>dubbo-samples-mock-consumer</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-samples-mock-interface</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+
+ <!-- dubbo -->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-spring-boot-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+
<artifactId>dubbo-zookeeper-curator5-spring-boot-starter</artifactId>
+ </dependency>
+
+ <!-- spring starter -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j2</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/api/DemoServiceMock.java
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/java/org/apache/dubbo/samples/mock/api/DemoServiceMock.java
similarity index 92%
rename from
2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/api/DemoServiceMock.java
rename to
2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/java/org/apache/dubbo/samples/mock/api/DemoServiceMock.java
index cbbd897dc..ad2bdd911 100644
---
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/api/DemoServiceMock.java
+++
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/java/org/apache/dubbo/samples/mock/api/DemoServiceMock.java
@@ -17,8 +17,8 @@
package org.apache.dubbo.samples.mock.api;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
public class DemoServiceMock implements DemoService {
private static Logger logger =
LoggerFactory.getLogger(DemoServiceMock.class);
diff --git
a/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/java/org/apache/dubbo/samples/mock/consumer/ConsumerApplication.java
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/java/org/apache/dubbo/samples/mock/consumer/ConsumerApplication.java
new file mode 100644
index 000000000..dc394923e
--- /dev/null
+++
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/java/org/apache/dubbo/samples/mock/consumer/ConsumerApplication.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+package org.apache.dubbo.samples.mock.consumer;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableDubbo
+public class ConsumerApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ConsumerApplication.class, args);
+ }
+}
diff --git
a/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/java/org/apache/dubbo/samples/mock/consumer/Task.java
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/java/org/apache/dubbo/samples/mock/consumer/Task.java
new file mode 100644
index 000000000..88756dfa2
--- /dev/null
+++
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/java/org/apache/dubbo/samples/mock/consumer/Task.java
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+package org.apache.dubbo.samples.mock.consumer;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.samples.mock.api.DemoService;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+@Component
+public class Task implements CommandLineRunner {
+ @DubboReference(mock = "true")
+ private DemoService demoService;
+
+ @Override
+ public void run(String... args) throws Exception {
+ String result = demoService.sayHello("world");
+ System.out.println("Receive result ======> " + result);
+
+ new Thread(()-> {
+ while (true) {
+ try {
+ Thread.sleep(1000);
+ System.out.println(new Date() + " Receive result ======> "
+ demoService.sayHello("world"));
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ Thread.currentThread().interrupt();
+ }
+ }
+ }).start();
+ }
+}
diff --git
a/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/resources/application.yml
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/resources/application.yml
new file mode 100644
index 000000000..4b329622e
--- /dev/null
+++
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/main/resources/application.yml
@@ -0,0 +1,21 @@
+# 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.
+
+dubbo:
+ application:
+ name: dubbo-samples-mock-consumer
+ registry:
+ address: zookeeper://${zookeeper.address:127.0.0.1}:2181
diff --git
a/2-advanced/dubbo-samples-mock/src/test/java/org/apache/dubbo/samples/mock/MockServicesIT.java
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/test/java/org/apache/dubbo/samples/mock/MockServicesIT.java
similarity index 71%
rename from
2-advanced/dubbo-samples-mock/src/test/java/org/apache/dubbo/samples/mock/MockServicesIT.java
rename to
2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/test/java/org/apache/dubbo/samples/mock/MockServicesIT.java
index 3c94c89ed..b8ff56780 100644
---
a/2-advanced/dubbo-samples-mock/src/test/java/org/apache/dubbo/samples/mock/MockServicesIT.java
+++
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-consumer/src/test/java/org/apache/dubbo/samples/mock/MockServicesIT.java
@@ -16,23 +16,25 @@
*/
package org.apache.dubbo.samples.mock;
+import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.samples.mock.api.DemoService;
-
+import org.apache.dubbo.samples.mock.consumer.ConsumerApplication;
import org.junit.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+import org.springframework.test.context.junit4.SpringRunner;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = "classpath*:spring/mock-consumer.xml")
+@SpringBootTest(classes = {ConsumerApplication.class})
+@RunWith(SpringRunner.class)
+@ExtendWith(SpringExtension.class)
public class MockServicesIT {
- @Autowired
- @Qualifier("demoService")
+
+ @DubboReference(mock = "true")
private DemoService service;
@Test
@@ -40,4 +42,4 @@ public class MockServicesIT {
String response = service.sayHello("world");
assertThat(response, is("mock world"));
}
-}
\ No newline at end of file
+}
diff --git a/2-advanced/dubbo-samples-mock/dubbo-samples-mock-interface/pom.xml
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-interface/pom.xml
new file mode 100644
index 000000000..b620bcbdc
--- /dev/null
+++ b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-interface/pom.xml
@@ -0,0 +1,38 @@
+<?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.
+ -->
+
+<project 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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-samples-mock</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>dubbo-samples-mock-interface</artifactId>
+
+ <properties>
+ <maven.compiler.source>17</maven.compiler.source>
+ <maven.compiler.target>17</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+
+</project>
diff --git
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/api/DemoService.java
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-interface/src/main/java/org/apache/dubbo/samples/mock/api/DemoService.java
similarity index 100%
rename from
2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/api/DemoService.java
rename to
2-advanced/dubbo-samples-mock/dubbo-samples-mock-interface/src/main/java/org/apache/dubbo/samples/mock/api/DemoService.java
diff --git a/2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/pom.xml
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/pom.xml
new file mode 100644
index 000000000..ce1c007fe
--- /dev/null
+++ b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/pom.xml
@@ -0,0 +1,70 @@
+<?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.
+ -->
+
+<project 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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-samples-mock</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>dubbo-samples-mock-provider</artifactId>
+
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-samples-mock-interface</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+
+ <!-- dubbo -->
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-spring-boot-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+
<artifactId>dubbo-zookeeper-curator5-spring-boot-starter</artifactId>
+ </dependency>
+
+ <!-- spring starter -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j2</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/impl/DemoServiceImpl.java
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/src/main/java/org/apache/dubbo/samples/mock/provider/DemoServiceImpl.java
similarity index 91%
rename from
2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/impl/DemoServiceImpl.java
rename to
2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/src/main/java/org/apache/dubbo/samples/mock/provider/DemoServiceImpl.java
index a516c7c06..b54bcd99f 100644
---
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/impl/DemoServiceImpl.java
+++
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/src/main/java/org/apache/dubbo/samples/mock/provider/DemoServiceImpl.java
@@ -15,10 +15,12 @@
* limitations under the License.
*/
-package org.apache.dubbo.samples.mock.impl;
+package org.apache.dubbo.samples.mock.provider;
+import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.samples.mock.api.DemoService;
+@DubboService
public class DemoServiceImpl implements DemoService {
public String sayHello(String name) {
diff --git
a/2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/src/main/java/org/apache/dubbo/samples/mock/provider/ProviderApplication.java
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/src/main/java/org/apache/dubbo/samples/mock/provider/ProviderApplication.java
new file mode 100644
index 000000000..36ac6e2ac
--- /dev/null
+++
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/src/main/java/org/apache/dubbo/samples/mock/provider/ProviderApplication.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+package org.apache.dubbo.samples.mock.provider;
+
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableDubbo
+public class ProviderApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(ProviderApplication.class, args);
+ }
+}
diff --git
a/2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/src/main/resources/application.yml
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/src/main/resources/application.yml
new file mode 100644
index 000000000..9b6a23612
--- /dev/null
+++
b/2-advanced/dubbo-samples-mock/dubbo-samples-mock-provider/src/main/resources/application.yml
@@ -0,0 +1,24 @@
+# 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.
+
+dubbo:
+ application:
+ name: dubbo-samples-mock-provider
+ protocol:
+ name: tri
+ port: 50052
+ registry:
+ address: zookeeper://${zookeeper.address:127.0.0.1}:2181
diff --git a/2-advanced/dubbo-samples-mock/pom.xml
b/2-advanced/dubbo-samples-mock/pom.xml
index 61cc94444..ba140697d 100644
--- a/2-advanced/dubbo-samples-mock/pom.xml
+++ b/2-advanced/dubbo-samples-mock/pom.xml
@@ -25,137 +25,85 @@
<modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+
<artifactId>dubbo-samples-mock</artifactId>
<name>Dubbo Samples Mock</name>
<description>Dubbo Samples Mock</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.version>4.3.30.RELEASE</spring.version>
- <log4j2.version>2.20.0</log4j2.version>
- <junit.version>4.13.1</junit.version>
+ <dubbo.version>3.3.0-beta.1</dubbo.version>
+ <spring-boot.version>3.2.3</spring-boot.version>
+
+ <junit5.version>5.10.1</junit5.version>
+ <junit.platform>1.9.3</junit.platform>
</properties>
+
+ <modules>
+ <module>dubbo-samples-mock-interface</module>
+ <module>dubbo-samples-mock-provider</module>
+ <module>dubbo-samples-mock-consumer</module>
+ </modules>
+
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-framework-bom</artifactId>
- <version>${spring.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-bom</artifactId>
- <version>${dubbo.version}</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper-curator5</artifactId>
- <version>${dubbo.version}</version>
- <type>pom</type>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ <version>${spring-boot.version}</version>
<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>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ <groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</dependency>
-
<dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-bom</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-dependencies-zookeeper-curator5</artifactId>
- <type>pom</type>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- Embedded Zookeeper Server Dependencies -->
- <dependency>
- <groupId>io.dropwizard.metrics</groupId>
- <artifactId>metrics-core</artifactId>
- <version>4.1.12.1</version>
- </dependency>
- <dependency>
- <groupId>org.xerial.snappy</groupId>
- <artifactId>snappy-java</artifactId>
- <version>1.1.10.5</version>
- </dependency>
</dependencies>
<build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.7.0</version>
- </plugin>
- </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <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>
</build>
-
- <profiles>
- <!-- For jdk 11 above JavaEE annotation -->
- <profile>
- <id>javax.annotation</id>
- <activation>
- <jdk>[1.11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- <version>1.3.2</version>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
</project>
diff --git
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/MockConsumer.java
b/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/MockConsumer.java
deleted file mode 100644
index 699ac6671..000000000
---
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/MockConsumer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.dubbo.samples.mock;
-
-import org.apache.dubbo.samples.mock.api.DemoService;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class MockConsumer {
- private static Logger logger = LoggerFactory.getLogger(MockConsumer.class);
-
- public static void main(String[] args) {
- ClassPathXmlApplicationContext context = new
ClassPathXmlApplicationContext("spring/mock-consumer.xml");
- context.start();
- DemoService demoService = context.getBean("demoService",
DemoService.class);
- String hello = demoService.sayHello("world");
- logger.info("result: " + hello);
- }
-}
diff --git
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/MockProvider.java
b/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/MockProvider.java
deleted file mode 100644
index 9c6afd716..000000000
---
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/MockProvider.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.dubbo.samples.mock;
-
-import org.apache.dubbo.samples.mock.zk.EmbeddedZooKeeper;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class MockProvider {
-
- public static void main(String[] args) throws Exception {
- new EmbeddedZooKeeper(2181, false).start();
- ClassPathXmlApplicationContext context = new
ClassPathXmlApplicationContext("spring/mock-provider.xml");
- context.start();
-
- System.out.println("dubbo service started");
- // press any key to exit
- System.in.read();
- }
-}
diff --git
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/zk/Configurator.java
b/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/zk/Configurator.java
deleted file mode 100644
index 050069944..000000000
---
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/zk/Configurator.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-package org.apache.dubbo.samples.mock.zk;
-
-import org.apache.curator.framework.CuratorFramework;
-import org.apache.curator.retry.ExponentialBackoffRetry;
-
-import static org.apache.curator.framework.CuratorFrameworkFactory.newClient;
-
-public class Configurator {
- private static CuratorFramework client;
-
- public static void main(String[] args) {
- client = newClient("127.0.0.1:2181", 60 * 1000, 60 * 1000, new
ExponentialBackoffRetry(6000, 3));
- client.start();
-
- generateServiceLevelOverride();
- }
-
- private static void generateServiceLevelOverride() {
- String str = "---\n" +
- "configVersion: v2.7\n" +
- "scope: service\n" +
- "key: org.apache.dubbo.samples.mock.api.DemoService\n" +
- "enabled: true\n" + "configs:\n" +
- "- addresses: [0.0.0.0]\n" +
- " side: consumer\n" +
- " parameters:\n" +
- " mock: return configured-mock-value\n"
- + "...\n";
-
- System.out.println(str);
-
- try {
- String path =
"/dubbo/config/org.apache.dubbo.samples.mock.api.DemoService/configurators";
- if (client.checkExists().forPath(path) == null) {
- client.create().creatingParentsIfNeeded().forPath(path);
- }
- setData(path, str);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private static void setData(String path, String data) throws Exception {
- client.setData().forPath(path, data.getBytes());
- }
-}
diff --git
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/zk/EmbeddedZooKeeper.java
b/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/zk/EmbeddedZooKeeper.java
deleted file mode 100644
index 62d601a59..000000000
---
a/2-advanced/dubbo-samples-mock/src/main/java/org/apache/dubbo/samples/mock/zk/EmbeddedZooKeeper.java
+++ /dev/null
@@ -1,309 +0,0 @@
-
-/*
- * Copyright 2014 the original author or authors.
- *
- * Licensed 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.
- */
-
-package org.apache.dubbo.samples.mock.zk;
-
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServerMain;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.SmartLifecycle;
-import org.springframework.util.ErrorHandler;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.ServerSocket;
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-/**
- * from:
https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
- * <p>
- * Helper class to start an embedded instance of standalone (non clustered)
ZooKeeper.
- * <p>
- * NOTE: at least an external standalone server (if not an ensemble) are
recommended, even for
- * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
- *
- * @author Patrick Peralta
- * @author Mark Fisher
- * @author David Turanski
- */
-public class EmbeddedZooKeeper implements SmartLifecycle {
-
- private static final Random RANDOM = new Random();
-
- /**
- * Logger.
- */
- private static final Logger logger =
LoggerFactory.getLogger(EmbeddedZooKeeper.class);
-
- /**
- * ZooKeeper client port. This will be determined dynamically upon startup.
- */
- private final int clientPort;
-
- /**
- * Whether to auto-start. Default is true.
- */
- private boolean autoStartup = true;
-
- /**
- * Lifecycle phase. Default is 0.
- */
- private int phase = 0;
-
- /**
- * Thread for running the ZooKeeper server.
- */
- private volatile Thread zkServerThread;
-
- /**
- * ZooKeeper server.
- */
- private volatile ZooKeeperServerMain zkServer;
-
- /**
- * {@link ErrorHandler} to be invoked if an Exception is thrown from the
ZooKeeper server thread.
- */
- private ErrorHandler errorHandler;
-
- private boolean daemon = true;
-
- /**
- * Construct an EmbeddedZooKeeper with a random port.
- */
- public EmbeddedZooKeeper() {
- clientPort = findRandomPort(30000, 65535);
- }
-
- /**
- * Construct an EmbeddedZooKeeper with the provided port.
- *
- * @param clientPort port for ZooKeeper server to bind to
- */
- public EmbeddedZooKeeper(int clientPort, boolean daemon) {
- this.clientPort = clientPort;
- this.daemon = daemon;
- }
-
- /**
- * Returns the port that clients should use to connect to this embedded
server.
- *
- * @return dynamically determined client port
- */
- public int getClientPort() {
- return this.clientPort;
- }
-
- /**
- * Specify whether to start automatically. Default is true.
- *
- * @param autoStartup whether to start automatically
- */
- public void setAutoStartup(boolean autoStartup) {
- this.autoStartup = autoStartup;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isAutoStartup() {
- return this.autoStartup;
- }
-
- /**
- * Specify the lifecycle phase for the embedded server.
- *
- * @param phase the lifecycle phase
- */
- public void setPhase(int phase) {
- this.phase = phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int getPhase() {
- return this.phase;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isRunning() {
- return (zkServerThread != null);
- }
-
- /**
- * Start the ZooKeeper server in a background thread.
- * <p>
- * Register an error handler via {@link #setErrorHandler} in order to
handle
- * any exceptions thrown during startup or execution.
- */
- @Override
- public synchronized void start() {
- if (zkServerThread == null) {
- zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper
Server Starter");
- zkServerThread.setDaemon(daemon);
- zkServerThread.start();
- }
- }
-
- /**
- * Shutdown the ZooKeeper server.
- */
- @Override
- public synchronized void stop() {
- if (zkServerThread != null) {
- // The shutdown method is protected...thus this hack to invoke it.
- // This will log an exception on shutdown; see
- // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for
details.
- try {
- Method shutdown =
ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
- shutdown.setAccessible(true);
- shutdown.invoke(zkServer);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- // It is expected that the thread will exit after
- // the server is shutdown; this will block until
- // the shutdown is complete.
- try {
- zkServerThread.join(5000);
- zkServerThread = null;
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- logger.warn("Interrupted while waiting for embedded ZooKeeper
to exit");
- // abandoning zk thread
- zkServerThread = null;
- }
- }
- }
-
- /**
- * Stop the server if running and invoke the callback when complete.
- */
- @Override
- public void stop(Runnable callback) {
- stop();
- callback.run();
- }
-
- /**
- * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown
from the ZooKeeper server thread. If none
- * is provided, only error-level logging will occur.
- *
- * @param errorHandler the {@link ErrorHandler} to be invoked
- */
- public void setErrorHandler(ErrorHandler errorHandler) {
- this.errorHandler = errorHandler;
- }
-
- /**
- * Runnable implementation that starts the ZooKeeper server.
- */
- private class ServerRunnable implements Runnable {
-
- @Override
- public void run() {
- try {
- Properties properties = new Properties();
- File file = new File(System.getProperty("java.io.tmpdir")
- + File.separator + UUID.randomUUID());
- file.deleteOnExit();
- properties.setProperty("dataDir", file.getAbsolutePath());
- properties.setProperty("clientPort",
String.valueOf(clientPort));
-
- QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
- quorumPeerConfig.parseProperties(properties);
-
- zkServer = new ZooKeeperServerMain();
- ServerConfig configuration = new ServerConfig();
- configuration.readFrom(quorumPeerConfig);
-
- System.setProperty("zookeeper.admin.enableServer", "false");
-
- zkServer.runFromConfig(configuration);
- } catch (Exception e) {
- if (errorHandler != null) {
- errorHandler.handleError(e);
- } else {
- logger.error("Exception running embedded ZooKeeper", e);
- }
- }
- }
- }
-
- /**
- * Workaround for SocketUtils.findRandomPort() deprecation.
- *
- * @param min min port
- * @param max max port
- * @return a random generated available port
- */
- private static int findRandomPort(int min, int max) {
- if (min < 1024) {
- throw new IllegalArgumentException("Max port shouldn't be less
than 1024.");
- }
-
- if (max > 65535) {
- throw new IllegalArgumentException("Max port shouldn't be greater
than 65535.");
- }
-
- if (min > max) {
- throw new IllegalArgumentException("Min port shouldn't be greater
than max port.");
- }
-
- int port = 0;
- int counter = 0;
-
- // Workaround for legacy JDK doesn't support Random.nextInt(min, max).
- List<Integer> randomInts = RANDOM.ints(min, max + 1)
- .limit(max - min)
- .mapToObj(Integer::valueOf)
- .collect(Collectors.toList());
-
- do {
- if (counter > max - min) {
- throw new IllegalStateException("Unable to find a port between
" + min + "-" + max);
- }
-
- port = randomInts.get(counter);
- counter++;
- } while (isPortInUse(port));
-
- return port;
- }
-
- private static boolean isPortInUse(int port) {
- try (ServerSocket ignored = new ServerSocket(port)) {
- return false;
- } catch (IOException e) {
- // continue
- }
- return true;
- }
-}
diff --git a/2-advanced/dubbo-samples-mock/src/main/resources/log4j2.xml
b/2-advanced/dubbo-samples-mock/src/main/resources/log4j2.xml
deleted file mode 100644
index 69e1321d2..000000000
--- a/2-advanced/dubbo-samples-mock/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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="WARN">
- <Appenders>
- <Console name="Console" target="SYSTEM_OUT" follow="true">
- <PatternLayout pattern="%style{%d{HH:mm:ss.SSS}}{Magenta}
%style{|-}{White}%highlight{%-5p} [%t] %style{%40.40c}{Cyan}:%style{%-3L}{Blue}
%style{-|}{White}
%m%n%rEx{filters(jdk.internal.reflect,java.lang.reflect,sun.reflect)}"
disableAnsi="false" charset="UTF-8"/>
- </Console>
- </Appenders>
- <Loggers>
- <Root level="info">
- <AppenderRef ref="Console"/>
- </Root>
- </Loggers>
-</Configuration>
diff --git
a/2-advanced/dubbo-samples-mock/src/main/resources/spring/mock-consumer.xml
b/2-advanced/dubbo-samples-mock/src/main/resources/spring/mock-consumer.xml
deleted file mode 100644
index 9753e0a34..000000000
--- a/2-advanced/dubbo-samples-mock/src/main/resources/spring/mock-consumer.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo
http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
-
- <!-- consumer's application name, used for tracing dependency relationship
(not a matching criterion),
- don't set it same as provider -->
- <dubbo:application name="mock-demo-consumer"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <!-- generate proxy for the remote service, then demoService can be used
in the same way as the
- local regular interface -->
- <dubbo:reference id="demoService" check="false"
interface="org.apache.dubbo.samples.mock.api.DemoService"
- mock="true"/>
-
-</beans>
diff --git
a/2-advanced/dubbo-samples-mock/src/main/resources/spring/mock-provider.xml
b/2-advanced/dubbo-samples-mock/src/main/resources/spring/mock-provider.xml
deleted file mode 100644
index 331b5ed41..000000000
--- a/2-advanced/dubbo-samples-mock/src/main/resources/spring/mock-provider.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
- xmlns="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
- http://dubbo.apache.org/schema/dubbo
http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
-
- <!-- provider's application name, used for tracing dependency relationship
-->
- <dubbo:application name="mock-demo-provider"/>
-
- <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
-
- <dubbo:provider token="true"/>
-
- <!-- use dubbo protocol to export service on port 20880 -->
- <dubbo:protocol name="dubbo" port="20880"/>
-
- <!-- service implementation, as same as regular local bean -->
- <bean id="demoService"
class="org.apache.dubbo.samples.mock.impl.DemoServiceImpl"/>
-
- <!-- declare the service interface to be exported -->
- <dubbo:service interface="org.apache.dubbo.samples.mock.api.DemoService"
ref="demoService"/>
-
-</beans>
diff --git a/2-advanced/pom.xml b/2-advanced/pom.xml
index 11a1e1836..80b20ae46 100644
--- a/2-advanced/pom.xml
+++ b/2-advanced/pom.xml
@@ -66,4 +66,4 @@
<module>dubbo-samples-spring-xml</module>
<module>dubbo-samples-api-with-registry</module>
</modules>
-</project>
\ No newline at end of file
+</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]