@@ -0,0 +1,2731 @@
+import com.netflix.hystrix.HystrixCommand;%0Aimport com.netflix.hystrix.HystrixCommandGroupKey;%0Aimport io.jboot.Jboot;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Apublic class HystrixTest %7B%0A    /**%0A     * %E6%9F%A5%E7%9C%8B%E7%9B%91%E6%8E%A7%E6%95%B0%E6%8D%AE%EF%BC%8C%E9%80%9A%E8%BF%87docker%E6%9D%A5%E8%BF%90%E8%A1%8Chystrix-dashboard%0A     * docker run --rm -ti -p 7979:7979 kennedyoliveira/hystrix-dashboard%0A     *%0A     * %E7%84%B6%E5%90%8E%E8%AE%BF%E9%97%AE%EF%BC%9Ahttp://127.0.0.1:7979/hystrix-dashboard %E5%B9%B6%E5%A1%AB%E5%86%99%E8%A7%82%E6%B5%8B%E7%9A%84url%0A     *%0A     * @param args%0A     */%0A    public static void main(String%5B%5D args) %7B%0A        Jboot.setBootArg(%22jboot.hystrix.streamUrl%22, %22/hystrix.stream%22);%0A        Jboot.run(args);%0A%0A%0A        while (true) %7B%0A            try %7B%0A                new CommandHelloWorld1(%22World%22).execute();%0A            %7Dcatch (Throwable ex)%7B%7D%0A        %7D%0A    %7D%0A%0A%0A%0A%0A    @Test%0A    public void testHello() %7B%0A        CommandHelloWorld cmd = new CommandHelloWorld(%22World%22);%0A        System.out.println(cmd.execute());%0A%0A        assertEquals(%22Hello World!%22, new CommandHelloWorld(%22World%22).execute());%0A        assertEquals(%22Hello Bob!%22, new CommandHelloWorld(%22Bob%22).execute());%0A    %7D%0A%0A%0A    public static class CommandHelloWorld extends HystrixCommand%3CString%3E %7B%0A%0A        private final String name;%0A%0A        public CommandHelloWorld(String name) %7B%0A            super(HystrixCommandGroupKey.Factory.asKey(%22ExampleGroup%22));%0A            this.name = name;%0A        %7D%0A%0A        @Override%0A        protected String run() %7B%0A            // a real example would do work like a network call here%0A%0A%0A            return %22Hello %22 + name + %22!%22;%0A        %7D%0A    %7D%0A%0A    public static class CommandHelloWorld1 extends HystrixCommand%3CString%3E %7B%0A%0A        private final String name;%0A%0A        public CommandHelloWorld1(String name) %7B%0A            super(HystrixCommandGroupKey.Factory.asKey(%22ExampleGroup%22));%0A            this.name = name;%0A        %7D%0A%0A        @Override%0A        protected String run() %7B%0A            // a real example would do work like a network call here%0A            try %7B%0A                Thread.sleep((int) (Math.random() * 10) + 2);%0A            %7D catch (InterruptedException e) %7B%0A                // do nothing%0A            %7D%0A%0A        /* fail 5%25 of the time to show how fallback works */%0A            if (Math.random() %3E 0.80) %7B%0A                throw new RuntimeException(%22random failure processing UserAccount network response%22);%0A            %7D%0A%0A        /* latency spike 5%25 of the time so timeouts can be triggered occasionally */%0A            if (Math.random() %3E 0.80) %7B%0A                // random latency spike%0A                try %7B%0A                    Thread.sleep((int) (Math.random() * 300) + 25);%0A                %7D catch (InterruptedException e) %7B%0A                    // do nothing%0A                %7D%0A            %7D%0A%0A%0A            return %22Hello %22 + name + %22!%22;%0A        %7D%0A    %7D%0A%7D%0A%0A%0A

add hystrix test