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/07/04 05:42:39 UTC

[dubbo-samples] branch master updated: integration test for dubbo-samples-spring-boot-hystrix

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 c680c6b  integration test for dubbo-samples-spring-boot-hystrix
c680c6b is described below

commit c680c6b9707604bf5f32a4ae345f07fa3d66cd50
Author: Ian Luo <ia...@gmail.com>
AuthorDate: Thu Jul 4 13:41:12 2019 +0800

    integration test for dubbo-samples-spring-boot-hystrix
---
 dubbo-samples-spring-boot-hystrix/pom.xml          | 432 +++++++--------------
 .../apache/dubbo/spring/boot/api/HelloService.java |  24 ++
 .../spring/boot/consumer/ConsumerApplication.java  |   9 +-
 .../spring/boot/provider/ProviderApplication.java  |  14 +-
 .../boot/provider/impl/HelloServiceImpl.java       |  37 ++
 .../src/main/java/org/example/HelloService.java    |  24 --
 .../main/java/org/example/HelloServiceImpl.java    |  37 --
 .../src/main/resources/application.properties      |  13 +-
 .../org/apache/dubbo/spring/boot/HystrixIT.java    |  40 ++
 9 files changed, 268 insertions(+), 362 deletions(-)

diff --git a/dubbo-samples-spring-boot-hystrix/pom.xml b/dubbo-samples-spring-boot-hystrix/pom.xml
index 70ca0ef..3d583fe 100644
--- a/dubbo-samples-spring-boot-hystrix/pom.xml
+++ b/dubbo-samples-spring-boot-hystrix/pom.xml
@@ -17,8 +17,8 @@
   -->
 
 <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">
+         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">
     <groupId>org.apache.dubbo</groupId>
     <version>1.0-SNAPSHOT</version>
 
@@ -30,333 +30,201 @@
     <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>
-        <main-class>com.alibaba.dubbo.spring.boot.provider.ProviderApplication</main-class>
+        <spring.boot.version>1.5.21.RELEASE</spring.boot.version>
+        <hystrix-starter.version>1.4.7.RELEASE</hystrix-starter.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>2.21.0</maven-failsafe-plugin.version>
+        <image.name>${artifactId}:${dubbo.version}</image.name>
+        <dubbo.port>20880</dubbo.port>
+        <zookeeper.port>2181</zookeeper.port>
+        <main-class>org.apache.dubbo.spring.boot.provider.ProviderApplication</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>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
+            <artifactId>dubbo-dependencies-zookeeper</artifactId>
+            <version>${dubbo.version}</version>
+            <type>pom</type>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
+
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
-            <version>1.4.4.RELEASE</version>
+            <version>${hystrix-starter.version}</version>
         </dependency>
 
         <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter</artifactId>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <scope>test</scope>
         </dependency>
 
         <dependency>
-            <groupId>com.alibaba.boot</groupId>
-            <artifactId>dubbo-spring-boot-starter</artifactId>
-            <version>0.1.0</version>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+            <version>${spring.boot.version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
+            <version>${spring.boot.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>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <configuration>
-                    <mainClass>${main-class}</mainClass>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </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>${zookeeper.port}</port>
+                                </ports>
+                                <environment>
+                                    <DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY>
+                                </environment>
+                                <jvmFlags>
+                                    <jvmFlag>-Dzookeeper.address=${dubbo-local-address}</jvmFlag>
+                                </jvmFlags>
+                            </container>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <phase>package</phase>
                                 <goals>
-                                    <goal>check</goal>
+                                    <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>${zookeeper.port}:${zookeeper.port}</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>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                                <configuration>
+                                    <systemPropertyVariables>
+                                        <zookeeper.address>${dubbo-local-address}</zookeeper.address>
+                                    </systemPropertyVariables>
+                                    <includes>
+                                        <include>**/*IT.java</include>
+                                    </includes>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
                 </plugins>
             </build>
         </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-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/api/HelloService.java b/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/api/HelloService.java
new file mode 100644
index 0000000..56f87af
--- /dev/null
+++ b/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/api/HelloService.java
@@ -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.
+ */
+
+package org.apache.dubbo.spring.boot.api;
+
+public interface HelloService {
+
+    String sayHello(String name);
+
+}
diff --git a/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/consumer/ConsumerApplication.java b/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/consumer/ConsumerApplication.java
index e011c11..d667224 100644
--- a/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/consumer/ConsumerApplication.java
+++ b/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/consumer/ConsumerApplication.java
@@ -22,8 +22,9 @@ import org.springframework.cloud.netflix.hystrix.EnableHystrix;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.stereotype.Service;
 
-import com.alibaba.dubbo.config.annotation.Reference;
-import org.example.HelloService;
+import org.apache.dubbo.config.annotation.Reference;
+import org.apache.dubbo.spring.boot.api.HelloService;
+
 import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
 
 @SpringBootApplication
@@ -39,10 +40,8 @@ public class ConsumerApplication {
         ConfigurableApplicationContext context = SpringApplication.run(ConsumerApplication.class, args);
         ConsumerApplication application = context.getBean(ConsumerApplication.class);
 
-        // server 端的hystrix会抛出异常,本地的调用结果会走 fallbackMethod
-        // 证明server 和 client端都经过 hystrix处理
         String result = application.doSayHello("world");
-        System.err.println("result :" + result);
+        System.out.println("result: " + result);
     }
 
     @HystrixCommand(fallbackMethod = "reliable")
diff --git a/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/provider/ProviderApplication.java b/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/provider/ProviderApplication.java
index 7fdf6cf..75c6ae1 100644
--- a/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/provider/ProviderApplication.java
+++ b/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/provider/ProviderApplication.java
@@ -16,23 +16,27 @@
  */
 package org.apache.dubbo.spring.boot.provider;
 
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.netflix.hystrix.EnableHystrix;
 
-import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
+import java.util.concurrent.CountDownLatch;
+
 
 @SpringBootApplication
 @EnableHystrix
-@EnableDubbo(scanBasePackages = { "org.example" })
+@EnableDubbo(scanBasePackages = {"org.apache.dubbo.spring.boot.provider.impl"})
 public class ProviderApplication {
 
-    public static void main(String[] args) {
-
-        // start embedded zookeeper server
+    public static void main(String[] args) throws Exception {
         new EmbeddedZooKeeper(2181, false).start();
 
         SpringApplication.run(ProviderApplication.class, args);
+
+        System.out.println("dubbo service started");
+        new CountDownLatch(1).await();
     }
 
 }
diff --git a/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/provider/impl/HelloServiceImpl.java b/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/provider/impl/HelloServiceImpl.java
new file mode 100644
index 0000000..fcf3182
--- /dev/null
+++ b/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/provider/impl/HelloServiceImpl.java
@@ -0,0 +1,37 @@
+/*
+ * 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.spring.boot.provider.impl;
+
+import org.apache.dubbo.config.annotation.Service;
+import org.apache.dubbo.spring.boot.api.HelloService;
+
+import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
+import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
+
+@Service(version = "1.0.0")
+public class HelloServiceImpl implements HelloService {
+
+    @HystrixCommand(commandProperties = {
+            @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "10"),
+            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "2000")})
+    @Override
+    public String sayHello(String name) {
+        throw new RuntimeException("Exception to show hystrix enabled.");
+    }
+
+}
diff --git a/dubbo-samples-spring-boot-hystrix/src/main/java/org/example/HelloService.java b/dubbo-samples-spring-boot-hystrix/src/main/java/org/example/HelloService.java
deleted file mode 100644
index 3c6fbaa..0000000
--- a/dubbo-samples-spring-boot-hystrix/src/main/java/org/example/HelloService.java
+++ /dev/null
@@ -1,24 +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.example;
-
-public interface HelloService {
-
-    String sayHello(String name);
-
-}
diff --git a/dubbo-samples-spring-boot-hystrix/src/main/java/org/example/HelloServiceImpl.java b/dubbo-samples-spring-boot-hystrix/src/main/java/org/example/HelloServiceImpl.java
deleted file mode 100644
index 57b27da..0000000
--- a/dubbo-samples-spring-boot-hystrix/src/main/java/org/example/HelloServiceImpl.java
+++ /dev/null
@@ -1,37 +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.example;
-
-import com.alibaba.dubbo.config.annotation.Service;
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
-
-@Service(version = "1.0.0")
-public class HelloServiceImpl implements HelloService {
-
-    @HystrixCommand(commandProperties = {
-                    @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "10"),
-                    @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "2000") })
-    @Override
-    public String sayHello(String name) {
-        // System.out.println("async provider received: " + name);
-        // return "annotation: hello, " + name;
-        throw new RuntimeException("Exception to show hystrix enabled.");
-    }
-
-}
diff --git a/dubbo-samples-spring-boot-hystrix/src/main/resources/application.properties b/dubbo-samples-spring-boot-hystrix/src/main/resources/application.properties
index 6cd57ca..42abf75 100644
--- a/dubbo-samples-spring-boot-hystrix/src/main/resources/application.properties
+++ b/dubbo-samples-spring-boot-hystrix/src/main/resources/application.properties
@@ -1,13 +1,8 @@
-
 # Dubbo Config properties
 ## ApplicationConfig Bean
-dubbo.application.name= dubbo-demo
-
+dubbo.application.name=dubbo-hystrix-demo
 ## RegistryConfig Bean
-dubbo.registry.id = my-registry
-dubbo.registry.address = zookeeper://localhost:2181?client=curator
-
-spring.aop.proxyTargetClass = true
-
-
+dubbo.registry.id=my-registry
+dubbo.registry.address=zookeeper://${zookeeper.address:localhost}:2181?client=curator
+spring.aop.proxyTargetClass=true
 dubbo.application.qosEnable=false
diff --git a/dubbo-samples-spring-boot-hystrix/src/test/java/org/apache/dubbo/spring/boot/HystrixIT.java b/dubbo-samples-spring-boot-hystrix/src/test/java/org/apache/dubbo/spring/boot/HystrixIT.java
new file mode 100644
index 0000000..c9f8b86
--- /dev/null
+++ b/dubbo-samples-spring-boot-hystrix/src/test/java/org/apache/dubbo/spring/boot/HystrixIT.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.spring.boot;
+
+
+import org.apache.dubbo.spring.boot.consumer.ConsumerApplication;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {ConsumerApplication.class})
+public class HystrixIT {
+    @Autowired
+    private ConsumerApplication consumerApplication;
+
+    @Test
+    public void test() throws Exception {
+        Assert.assertEquals("hystrix fallback value", consumerApplication.doSayHello("hystrix"));
+    }
+}


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