You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by il...@apache.org on 2019/06/17 12:59:59 UTC

[dubbo-samples] branch master updated: integration test for dubbo-samples-compat

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

iluo 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 c5a800b  integration test for dubbo-samples-compat
c5a800b is described below

commit c5a800ba21893f2a61aac9604db3e195ec8f7e53
Author: Ian Luo <ia...@gmail.com>
AuthorDate: Mon Jun 17 20:59:11 2019 +0800

    integration test for dubbo-samples-compat
---
 dubbo-samples-compatible/pom.xml                   | 386 +++++++--------------
 .../dubbo/samples/basic/filter/TraceFilter.java    |  41 +++
 .../dubbo/samples/basic/impl/DemoServiceImpl.java  |  15 +-
 .../BasicConsumer.java => compat/Consumer.java}    |  26 +-
 .../{compatible => compat}/EmbeddedZooKeeper.java  |   4 +-
 .../BasicProvider.java => compat/Provider.java}    |  10 +-
 .../META-INF/dubbo/com.alibaba.dubbo.rpc.Filter    |   2 +-
 ...demo-consumer.xml => dubbo-compat-consumer.xml} |  14 +-
 ...demo-provider.xml => dubbo-compat-provider.xml} |  17 +-
 .../apache/dubbo/samples/compat/DemoServiceIT.java |  40 +++
 10 files changed, 243 insertions(+), 312 deletions(-)

diff --git a/dubbo-samples-compatible/pom.xml b/dubbo-samples-compatible/pom.xml
index 0d7d122..2720956 100644
--- a/dubbo-samples-compatible/pom.xml
+++ b/dubbo-samples-compatible/pom.xml
@@ -27,291 +27,158 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>dubbo-samples-compatible</artifactId>
+
     <properties>
         <source.level>1.8</source.level>
         <target.level>1.8</target.level>
+        <dubbo.version>2.7.2</dubbo.version>
         <spring.version>4.3.16.RELEASE</spring.version>
-        <dubbo.version>2.7.0</dubbo.version>
-        <dubbo.rpc.version>2.7.0</dubbo.rpc.version>
-        <zookeeper.version>3.4.13</zookeeper.version>
-        <curator.version>4.0.1</curator.version>
-        <validation-api.version>1.1.0.Final</validation-api.version>
-        <hibernate-validator.version>4.2.0.Final</hibernate-validator.version>
-        <resteasy.version>3.0.19.Final</resteasy.version>
-        <curator-client.version>4.0.1</curator-client.version>
-        <swagger.version>1.5.19</swagger.version>
-        <tomcat.version>7.0.88</tomcat.version>
-        <servlet.version>3.0.1</servlet.version>
-        <maven_checkstyle_version>3.0.0</maven_checkstyle_version>
-        <apache-rat-plugin.version>0.12</apache-rat-plugin.version>
-        <spring-boot.version>1.5.13.RELEASE</spring-boot.version>
+        <junit.version>4.12</junit.version>
+        <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
+        <jib-maven-plugin.version>1.2.0</jib-maven-plugin.version>
+        <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+        <maven-failsafe-plugin.version>3.0.0-M3</maven-failsafe-plugin.version>
+        <image.name>${artifactId}:${dubbo.version}</image.name>
+        <dubbo.port>20890</dubbo.port>
+        <main-class>org.apache.dubbo.samples.compat.Provider</main-class>
     </properties>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.springframework</groupId>
-                <artifactId>spring-framework-bom</artifactId>
-                <version>${spring.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <!-- Import dependency management from Spring Boot -->
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-dependencies</artifactId>
-                <version>${spring-boot.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>io.netty</groupId>
-                <artifactId>netty-all</artifactId>
-                <version>4.1.16.Final</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.dubbo</groupId>
-                <artifactId>dubbo-bom</artifactId>
-                <version>${dubbo.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.dubbo</groupId>
-                <artifactId>dubbo</artifactId>
-                <version>${dubbo.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.apache.thrift</groupId>
-                        <artifactId>libthrift</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.dubbo</groupId>
-                <artifactId>dubbo-rpc-rest</artifactId>
-                <version>${dubbo.rpc.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.zookeeper</groupId>
-                <artifactId>zookeeper</artifactId>
-                <version>${zookeeper.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.curator</groupId>
-                <artifactId>curator-framework</artifactId>
-                <version>${curator.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.apache.zookeeper</groupId>
-                        <artifactId>zookeeper</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>javax.validation</groupId>
-                <artifactId>validation-api</artifactId>
-                <version>${validation-api.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.hibernate</groupId>
-                <artifactId>hibernate-validator</artifactId>
-                <version>${hibernate-validator.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.jboss.resteasy</groupId>
-                <artifactId>resteasy-jackson-provider</artifactId>
-                <version>${resteasy.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.curator</groupId>
-                <artifactId>curator-client</artifactId>
-                <version>${curator-client.version}</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.apache.zookeeper</groupId>
-                        <artifactId>zookeeper</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>javax.servlet</groupId>
-                <artifactId>javax.servlet-api</artifactId>
-                <version>${servlet.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.tomcat.embed</groupId>
-                <artifactId>tomcat-embed-core</artifactId>
-                <version>${tomcat.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.tomcat.embed</groupId>
-                <artifactId>tomcat-embed-logging-juli</artifactId>
-                <version>${tomcat.version}</version>
-            </dependency>
-            <!-- swagger -->
-            <dependency>
-                <groupId>io.swagger</groupId>
-                <artifactId>swagger-annotations</artifactId>
-                <version>${swagger.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>io.swagger</groupId>
-                <artifactId>swagger-jaxrs</artifactId>
-                <version>${swagger.version}</version>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
         <dependency>
-            <groupId>org.apache.curator</groupId>
-            <artifactId>curator-framework</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>io.netty</groupId>
-                    <artifactId>netty</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.apache.zookeeper</groupId>
-                    <artifactId>zookeeper</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.zookeeper</groupId>
-            <artifactId>zookeeper</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.dubbo</groupId>
             <artifactId>dubbo</artifactId>
+            <version>${dubbo.version}</version>
         </dependency>
+
         <dependency>
             <groupId>org.apache.dubbo</groupId>
-            <artifactId>dubbo-configcenter-zookeeper</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.netty</groupId>
-            <artifactId>netty-all</artifactId>
+            <artifactId>dubbo-dependencies-zookeeper</artifactId>
+            <version>${dubbo.version}</version>
+            <type>pom</type>
         </dependency>
+
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <scope>test</scope>
         </dependency>
+
         <dependency>
             <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
+            <artifactId>spring-test</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
         </dependency>
     </dependencies>
 
-
-
-    <build>
-        <pluginManagement>
-            <plugins>
-                <plugin>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-maven-plugin</artifactId>
-                    <version>${spring-boot.version}</version>
-                </plugin>
-            </plugins>
-        </pluginManagement>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.7.0</version>
-                <configuration>
-                    <source>${source.level}</source>
-                    <target>${target.level}</target>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.rat</groupId>
-                <artifactId>apache-rat-plugin</artifactId>
-                <version>${apache-rat-plugin.version}</version>
-                <executions>
-                    <execution>
-                        <id>verify.rat</id>
-                        <phase>verify</phase>
-                        <goals>
-                            <goal>check</goal>
-                        </goals>
-                        <configuration>
-                            <excludes>
-                                <exclude>**/*.versionsBackup</exclude>
-                                <exclude>**/.idea/</exclude>
-                                <exclude>**/*.iml</exclude>
-                                <exclude>**/*.txt</exclude>
-                                <exclude>**/*.load</exclude>
-                                <exclude>**/*.flex</exclude>
-                                <exclude>**/*.fc</exclude>
-                                <exclude>**/*.javascript</exclude>
-                                <exclude>**/*.properties</exclude>
-                                <exclude>**/*.thrift</exclude>
-                                <exclude>**/*.sh</exclude>
-                                <exclude>**/*.bat</exclude>
-                                <exclude>**/*.md</exclude>
-                                <exclude>.git/</exclude>
-                                <exclude>.gitignore</exclude>
-                                <!-- ASF jenkins box puts the Maven repo in our root directory. -->
-                                <exclude>.repository/</exclude>
-                                <exclude>**/.settings/*</exclude>
-                                <exclude>**/.classpath</exclude>
-                                <exclude>**/.project</exclude>
-                                <exclude>**/target/**</exclude>
-                                <exclude>**/*.log</exclude>
-                                <exclude>CODE_OF_CONDUCT.md</exclude>
-                                <exclude>.codecov.yml</exclude>
-                                <exclude>.travis.yml</exclude>
-                                <exclude>PULL_REQUEST_TEMPLATE.md</exclude>
-                                <exclude>CONTRIBUTING.md</exclude>
-                                <exclude>README.md</exclude>
-                                <exclude>**/codestyle/*</exclude>
-                                <exclude>**/resources/META-INF/**</exclude>
-                                <exclude>**/webapp/swagger/**</exclude>
-                                <exclude>**/org/apache/dubbo/samples/rpc/nativethrift/api/DemoService.java</exclude>
-                            </excludes>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
     <profiles>
         <profile>
-            <id>checkstyle</id>
-            <activation>
-                <jdk>[1.8,)</jdk>
-            </activation>
+            <id>dubbo-integration-test</id>
             <build>
                 <plugins>
                     <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-checkstyle-plugin</artifactId>
-                        <version>${maven_checkstyle_version}</version>
-                        <dependencies>
-                            <dependency>
-                                <groupId>com.puppycrawl.tools</groupId>
-                                <artifactId>checkstyle</artifactId>
-                                <version>8.9</version>
-                            </dependency>
-                        </dependencies>
+                        <groupId>org.apache.dubbo</groupId>
+                        <artifactId>dubbo-maven-address-plugin</artifactId>
+                        <version>1.0-SNAPSHOT</version>
                         <executions>
                             <execution>
-                                <id>checkstyle-validation</id>
-                                <phase>validate</phase>
+                                <goals>
+                                    <goal>local-address</goal>
+                                </goals>
                                 <configuration>
-                                    <configLocation>../codestyle/checkstyle.xml</configLocation>
-                                    <suppressionsLocation>../codestyle/checkstyle-suppressions.xml</suppressionsLocation>
-                                    <encoding>UTF-8</encoding>
-                                    <consoleOutput>true</consoleOutput>
-                                    <failOnViolation>true</failOnViolation>
+                                    <localAddress>dubbo-local-address</localAddress>
                                 </configuration>
+                                <phase>initialize</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>com.google.cloud.tools</groupId>
+                        <artifactId>jib-maven-plugin</artifactId>
+                        <version>${jib-maven-plugin.version}</version>
+                        <configuration>
+                            <from>
+                                <image>openjdk:8</image>
+                            </from>
+                            <to>
+                                <image>${image.name}</image>
+                            </to>
+                            <container>
+                                <mainClass>${main-class}</mainClass>
+                                <ports>
+                                    <port>${dubbo.port}</port>
+                                    <port>2181</port>
+                                </ports>
+                                <environment>
+                                    <DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY>
+                                </environment>
+                            </container>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>dockerBuild</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>io.fabric8</groupId>
+                        <artifactId>docker-maven-plugin</artifactId>
+                        <version>${docker-maven-plugin.version}</version>
+                        <configuration>
+                            <images>
+                                <image>
+                                    <name>${image.name}</name>
+                                    <run>
+                                        <ports>
+                                            <port>${dubbo.port}:${dubbo.port}</port>
+                                            <port>2181:2181</port>
+                                        </ports>
+                                        <wait>
+                                            <log>dubbo service started</log>
+                                        </wait>
+                                    </run>
+                                </image>
+                            </images>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>start</id>
+                                <phase>pre-integration-test</phase>
+                                <goals>
+                                    <goal>start</goal>
+                                </goals>
+                            </execution>
+                            <execution>
+                                <id>stop</id>
+                                <phase>post-integration-test</phase>
+                                <goals>
+                                    <goal>stop</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <version>${maven-failsafe-plugin.version}</version>
+                        <executions>
+                            <execution>
                                 <goals>
-                                    <goal>check</goal>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
                                 </goals>
+                                <configuration>
+                                    <includes>
+                                        <include>**/*IT.java</include>
+                                    </includes>
+                                </configuration>
                             </execution>
                         </executions>
                     </plugin>
@@ -320,4 +187,17 @@
         </profile>
     </profiles>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>${maven-compiler-plugin.version}</version>
+                <configuration>
+                    <source>${source.level}</source>
+                    <target>${target.level}</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/basic/filter/TraceFilter.java b/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/basic/filter/TraceFilter.java
new file mode 100644
index 0000000..935b5f4
--- /dev/null
+++ b/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/basic/filter/TraceFilter.java
@@ -0,0 +1,41 @@
+/*
+ * 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.basic.filter;
+
+import org.apache.dubbo.samples.basic.api.User;
+
+import com.alibaba.dubbo.common.extension.Activate;
+import com.alibaba.dubbo.rpc.Filter;
+import com.alibaba.dubbo.rpc.Invocation;
+import com.alibaba.dubbo.rpc.Invoker;
+import com.alibaba.dubbo.rpc.Result;
+import com.alibaba.dubbo.rpc.RpcException;
+
+@Activate(group = {"provider"})
+public class TraceFilter implements Filter {
+    @Override
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
+        Result result = invoker.invoke(invocation);
+        Object o = result.getValue();
+        if (o instanceof User) {
+            User u = (User) o;
+            u.setName("filtered: " + u.getName());
+        }
+        return result;
+    }
+}
diff --git a/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/basic/impl/DemoServiceImpl.java b/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/basic/impl/DemoServiceImpl.java
index 4b5848e..3754bc3 100644
--- a/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/basic/impl/DemoServiceImpl.java
+++ b/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/basic/impl/DemoServiceImpl.java
@@ -19,21 +19,22 @@
 
 package org.apache.dubbo.samples.basic.impl;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.apache.dubbo.rpc.RpcContext;
 import org.apache.dubbo.samples.basic.api.DemoService;
 import org.apache.dubbo.samples.basic.api.Phone;
 import org.apache.dubbo.samples.basic.api.User;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import static org.apache.dubbo.rpc.RpcContext.getContext;
+
 public class DemoServiceImpl implements DemoService {
 
     @Override
     public String sayHello(String name) {
-        System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name + ", request from consumer: " + RpcContext
-            .getContext().getRemoteAddress());
-        return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress();
+        System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name +
+                ", request from consumer: " + getContext().getRemoteAddress());
+        return "Hello " + name + ", response from provider: " + getContext().getLocalAddress();
     }
 
     @Override
diff --git a/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compatible/BasicConsumer.java b/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compat/Consumer.java
similarity index 65%
rename from dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compatible/BasicConsumer.java
rename to dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compat/Consumer.java
index 4a0aacf..9277e70 100644
--- a/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compatible/BasicConsumer.java
+++ b/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compat/Consumer.java
@@ -17,32 +17,22 @@
  *
  */
 
-package org.apache.dubbo.samples.compatible;
+package org.apache.dubbo.samples.compat;
 
 import org.apache.dubbo.samples.basic.api.DemoService;
 import org.apache.dubbo.samples.basic.api.User;
 
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-public class BasicConsumer {
+public class Consumer {
 
     public static void main(String[] args) {
-        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"spring/dubbo-demo-consumer.xml"});
+        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-compat-consumer.xml");
         context.start();
-        DemoService demoService = (DemoService) context.getBean("demoService"); // get remote service proxy
-
-        while (true) {
-            try {
-                String hello = demoService.sayHello("world"); // call remote method
-                System.out.println(hello); // get result
-
-                User user = demoService.getUser(1);
-                System.out.println(user);
-
-                Thread.sleep(1000);
-            } catch (Throwable throwable) {
-                System.out.println(throwable.getMessage());
-            }
-        }
+        DemoService demoService = (DemoService) context.getBean("demoService");
+        String hello = demoService.sayHello("world");
+        System.out.println(hello);
+        User user = demoService.getUser(1);
+        System.out.println(user);
     }
 }
diff --git a/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compatible/EmbeddedZooKeeper.java b/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compat/EmbeddedZooKeeper.java
similarity index 99%
rename from dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compatible/EmbeddedZooKeeper.java
rename to dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compat/EmbeddedZooKeeper.java
index bf97105..dafe2d8 100644
--- a/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compatible/EmbeddedZooKeeper.java
+++ b/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compat/EmbeddedZooKeeper.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.dubbo.samples.compatible;
+package org.apache.dubbo.samples.compat;
 
 import org.apache.zookeeper.server.ServerConfig;
 import org.apache.zookeeper.server.ZooKeeperServerMain;
@@ -252,4 +252,4 @@ public class EmbeddedZooKeeper implements SmartLifecycle {
         }
     }
 
-}
\ No newline at end of file
+}
diff --git a/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compatible/BasicProvider.java b/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compat/Provider.java
similarity index 84%
rename from dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compatible/BasicProvider.java
rename to dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compat/Provider.java
index 90af08f..49c517a 100644
--- a/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compatible/BasicProvider.java
+++ b/dubbo-samples-compatible/src/main/java/org/apache/dubbo/samples/compat/Provider.java
@@ -17,18 +17,18 @@
  *
  */
 
-package org.apache.dubbo.samples.compatible;
+package org.apache.dubbo.samples.compat;
 
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-public class BasicProvider {
+public class Provider {
 
     public static void main(String[] args) throws Exception {
         new EmbeddedZooKeeper(2181, false).start();
-        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"spring/dubbo-demo-provider.xml"});
+        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-compat-provider.xml");
         context.start();
-
-        System.in.read(); // press any key to exit
+        System.out.println("dubbo service started");
+        System.in.read();
     }
 
 }
diff --git a/dubbo-samples-compatible/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.Filter b/dubbo-samples-compatible/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.Filter
index 42c21d7..090b07a 100644
--- a/dubbo-samples-compatible/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.Filter
+++ b/dubbo-samples-compatible/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.Filter
@@ -1 +1 @@
-trace1=org.apache.dubbo.samples.basic.TraceFilter
\ No newline at end of file
+trace1=org.apache.dubbo.samples.basic.filter.TraceFilter
diff --git a/dubbo-samples-compatible/src/main/resources/spring/dubbo-demo-consumer.xml b/dubbo-samples-compatible/src/main/resources/spring/dubbo-compat-consumer.xml
similarity index 75%
rename from dubbo-samples-compatible/src/main/resources/spring/dubbo-demo-consumer.xml
rename to dubbo-samples-compatible/src/main/resources/spring/dubbo-compat-consumer.xml
index 79edf43..4c2e677 100644
--- a/dubbo-samples-compatible/src/main/resources/spring/dubbo-demo-consumer.xml
+++ b/dubbo-samples-compatible/src/main/resources/spring/dubbo-compat-consumer.xml
@@ -24,15 +24,7 @@
        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="demo-consumer"/>
-
-    <!-- use multicast registry center to discover service -->
-    <dubbo:registry group="aaa" address="zookeeper://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:application name="compat-consumer"/>
+    <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
     <dubbo:reference id="demoService" check="false" interface="org.apache.dubbo.samples.basic.api.DemoService"/>
-
-</beans>
\ No newline at end of file
+</beans>
diff --git a/dubbo-samples-compatible/src/main/resources/spring/dubbo-demo-provider.xml b/dubbo-samples-compatible/src/main/resources/spring/dubbo-compat-provider.xml
similarity index 74%
rename from dubbo-samples-compatible/src/main/resources/spring/dubbo-demo-provider.xml
rename to dubbo-samples-compatible/src/main/resources/spring/dubbo-compat-provider.xml
index b698827..44c5191 100644
--- a/dubbo-samples-compatible/src/main/resources/spring/dubbo-demo-provider.xml
+++ b/dubbo-samples-compatible/src/main/resources/spring/dubbo-compat-provider.xml
@@ -23,22 +23,9 @@
        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="demo-provider"/>
-
-    <!-- use multicast registry center to export service -->
-    <dubbo:registry group="aaa" address="zookeeper://127.0.0.1:2181"/>
+    <dubbo:application name="compat-provider"/>
     <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
-    <!--<dubbo:registry address="zookeeper://11.163.250.27:2181"/>-->
-
-    <!-- use dubbo protocol to export service on port 20880 -->
     <dubbo:protocol name="dubbo" port="20890"/>
-
-    <!-- service implementation, as same as regular local bean -->
     <bean id="demoService" class="org.apache.dubbo.samples.basic.impl.DemoServiceImpl"/>
-
-    <!-- declare the service interface to be exported -->
     <dubbo:service interface="org.apache.dubbo.samples.basic.api.DemoService" ref="demoService"/>
-
-</beans>
\ No newline at end of file
+</beans>
diff --git a/dubbo-samples-compatible/src/test/java/org/apache/dubbo/samples/compat/DemoServiceIT.java b/dubbo-samples-compatible/src/test/java/org/apache/dubbo/samples/compat/DemoServiceIT.java
new file mode 100644
index 0000000..cb4bb48
--- /dev/null
+++ b/dubbo-samples-compatible/src/test/java/org/apache/dubbo/samples/compat/DemoServiceIT.java
@@ -0,0 +1,40 @@
+/*
+ * 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.compat;
+
+import org.apache.dubbo.samples.basic.api.DemoService;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = "classpath*:spring/dubbo-compat-consumer.xml")
+public class DemoServiceIT {
+    @Autowired
+    private DemoService demoService;
+
+    @Test
+    public void test() throws Exception {
+        Assert.assertTrue(demoService.sayHello("world").startsWith("Hello world"));
+        Assert.assertEquals(demoService.getUser(1).getName(), "filtered: aaa");
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org