diff --git a/eureka-noweb/pom.xml b/eureka-noweb/pom.xml index 0c7f182..3ca3f0f 100644 --- a/eureka-noweb/pom.xml +++ b/eureka-noweb/pom.xml @@ -63,6 +63,21 @@ + + com.sun.jersey + jersey-core + 1.19.1 + + + com.sun.jersey + jersey-client + 1.19.1 + + + com.sun.jersey.contribs + jersey-apache-client4 + 1.19.1 + org.springframework.boot spring-boot-starter-test diff --git a/eureka-noweb/src/main/resources/application.yml b/eureka-noweb/src/main/resources/application.yml index 54d5e12..fed3a00 100644 --- a/eureka-noweb/src/main/resources/application.yml +++ b/eureka-noweb/src/main/resources/application.yml @@ -4,3 +4,5 @@ spring: server: port: 7788 + +debug: true diff --git a/feign-eureka/pom.xml b/feign-eureka/pom.xml index a9d1f85..7ccacc7 100644 --- a/feign-eureka/pom.xml +++ b/feign-eureka/pom.xml @@ -61,6 +61,10 @@ org.springframework.cloud spring-cloud-starter-openfeign + + org.springframework.cloud + spring-cloud-starter-loadbalancer + org.springframework.boot spring-boot-starter-test diff --git a/feign-eureka/src/main/java/demo/HelloClientApplication.java b/feign-eureka/src/main/java/demo/HelloClientApplication.java index 5ced5b0..c8b4ca3 100644 --- a/feign-eureka/src/main/java/demo/HelloClientApplication.java +++ b/feign-eureka/src/main/java/demo/HelloClientApplication.java @@ -1,24 +1,21 @@ package demo; -import static org.springframework.web.bind.annotation.RequestMethod.GET; - -import java.util.Arrays; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.server.LocalServerPort; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient; +import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.cloud.netflix.ribbon.RibbonClient; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; +import org.springframework.core.env.Environment; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import com.netflix.loadbalancer.BaseLoadBalancer; -import com.netflix.loadbalancer.ILoadBalancer; -import com.netflix.loadbalancer.Server; +import static org.springframework.web.bind.annotation.RequestMethod.GET; /** * @author Spencer Gibb @@ -27,7 +24,7 @@ import com.netflix.loadbalancer.Server; @EnableDiscoveryClient @RestController @EnableFeignClients -@RibbonClient(name = "hello", configuration = HelloRibbonClientConfiguration.class) +@LoadBalancerClient(name = "hello", configuration = HelloClientApplication.HelloClientConfiguration.class) public class HelloClientApplication { @Autowired HelloClient client; @@ -37,28 +34,34 @@ public class HelloClientApplication { return client.hello(); } + @RequestMapping("/world") + public String world() { + return "hello world"; + } + public static void main(String[] args) { SpringApplication.run(HelloClientApplication.class, args); } @FeignClient("hello") interface HelloClient { - @RequestMapping(value = "/", method = GET) + @RequestMapping(value = "/world", method = GET) String hello(); } -} + // Load balancer with fixed server list for "hello" pointing to example.com + static class HelloClientConfiguration { -// Load balancer with fixed server list for "hello" pointing to example.com -@Configuration -class HelloRibbonClientConfiguration { + @Bean + @Lazy + public ServiceInstanceListSupplier myServiceInstanceListSupplier(Environment env) { + //because of this, it doesn't use eureka to lookup the server, + // but the classpath is tested + Integer port = env.getProperty("local.server.port", Integer.class); + return ServiceInstanceListSupplier.fixed(env) + .instance("localhost", port, "hello").build(); + } - @Bean - public ILoadBalancer ribbonLoadBalancer() { - //because of this, it doesn't use eureka to lookup the server, - // but the classpath is tested - BaseLoadBalancer balancer = new BaseLoadBalancer(); - balancer.setServersList(Arrays.asList(new Server("example.com", 443))); - return balancer; } } + diff --git a/feign-eureka/src/test/java/demo/HelloClientApplicationTests.java b/feign-eureka/src/test/java/demo/HelloClientApplicationTests.java index 650efca..33c3ae2 100644 --- a/feign-eureka/src/test/java/demo/HelloClientApplicationTests.java +++ b/feign-eureka/src/test/java/demo/HelloClientApplicationTests.java @@ -1,20 +1,21 @@ package demo; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Value; + import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + // We disable Hystrix because we are not concerned about testing circuit breakers in this // test and it eliminates hystrix timeouts from messing with the request @RunWith(SpringRunner.class) @@ -22,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; @DirtiesContext public class HelloClientApplicationTests { - @Value("${local.server.port}") + @LocalServerPort int port; @Test @@ -31,7 +32,7 @@ public class HelloClientApplicationTests { .getForEntity("http://localhost:" + port, String.class); assertNotNull("response was null", response); assertEquals("Wrong status code", HttpStatus.OK, response.getStatusCode()); - assertTrue(response.getBody().contains(" - - 4.0.0 - - org.springframework.cloud.test - spring-cloud-test-feign-hystrix - ${spring-cloud.version} - jar - - spring-cloud-test-feign-hystrix - Demo project for Spring Cloud - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.BUILD-SNAPSHOT - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - UTF-8 - 1.8 - 2020.0.0-SNAPSHOT - - - - - org.springframework.cloud - spring-cloud-starter-openfeign - - - org.springframework.cloud - spring-cloud-starter-netflix-ribbon - - - org.springframework.cloud - spring-cloud-starter-netflix-hystrix - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.boot - spring-boot-starter-web - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - maven-deploy-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - diff --git a/feign-hystrix/src/main/java/demo/FeignClientApplication.java b/feign-hystrix/src/main/java/demo/FeignClientApplication.java deleted file mode 100644 index 5fd50ef..0000000 --- a/feign-hystrix/src/main/java/demo/FeignClientApplication.java +++ /dev/null @@ -1,46 +0,0 @@ -package demo; - -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.openfeign.EnableFeignClients; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.context.annotation.Bean; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -@SpringBootApplication -@EnableFeignClients -public class FeignClientApplication { - - @Bean - public ApplicationRunner runner(final UrlRestClient client) { - return new ApplicationRunner() { - - @Override - public void run(ApplicationArguments args) throws Exception { - System.err.println(client.hello()); - } - }; - } - - public static void main(String[] args) { - SpringApplication.run(FeignClientApplication.class, args); - } -} - -@FeignClient(name = "example", url = "https://example.com", fallback=FallbackClient.class) -interface UrlRestClient { - @RequestMapping(value="/", method = RequestMethod.GET) - String hello(); -} - -@Component -class FallbackClient implements UrlRestClient { - @Override - public String hello() { - return "oops"; - } -} diff --git a/feign-hystrix/src/main/resources/application.properties b/feign-hystrix/src/main/resources/application.properties deleted file mode 100644 index e69de29..0000000 diff --git a/feign-hystrix/src/test/java/demo/AdhocTestSuite.java b/feign-hystrix/src/test/java/demo/AdhocTestSuite.java deleted file mode 100644 index 5408619..0000000 --- a/feign-hystrix/src/test/java/demo/AdhocTestSuite.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2012-2013 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 - * - * https://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 demo; - -import org.junit.Ignore; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -/** - * A test suite for probing weird ordering problems in the tests. - * - * @author Dave Syer - */ -@RunWith(Suite.class) -@SuiteClasses({ FeignClientApplicationTests.class, - FeignClientWithServerListApplicationTests.class }) -@Ignore("Test suite for tracking order dependencies") -public class AdhocTestSuite { - -} diff --git a/feign-hystrix/src/test/java/demo/FeignClientApplicationTests.java b/feign-hystrix/src/test/java/demo/FeignClientApplicationTests.java deleted file mode 100644 index 2fc3323..0000000 --- a/feign-hystrix/src/test/java/demo/FeignClientApplicationTests.java +++ /dev/null @@ -1,54 +0,0 @@ -package demo; - -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.cloud.openfeign.EnableFeignClients; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -import demo.FeignClientWithServerListApplicationTests.FallbackRestClient; - - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -@DirtiesContext -public class FeignClientApplicationTests { - - @Autowired - private UrlRestClient client; - - @Configuration - @EnableAutoConfiguration - @EnableFeignClients - protected static class TestApplication { - - @Bean - public FallbackClient fallback() { - return new FallbackClient(); - } - - @Bean - public FallbackRestClient fallbackRestClient() { - return new FallbackRestClient(); - } - - public static void main(String[] args) { - SpringApplication.run(FeignClientApplication.class, args); - } - } - - @Test - public void clientConnects() { - assertTrue(client.hello().contains(" org.springframework.boot diff --git a/feign/src/test/java/demo/FeignClientWithServerListApplicationTests.java b/feign/src/test/java/demo/FeignClientWithServerListApplicationTests.java index 791d675..081dd3f 100644 --- a/feign/src/test/java/demo/FeignClientWithServerListApplicationTests.java +++ b/feign/src/test/java/demo/FeignClientWithServerListApplicationTests.java @@ -2,6 +2,7 @@ package demo; import static org.junit.Assert.assertTrue; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -30,6 +31,7 @@ public class FeignClientWithServerListApplicationTests { @Autowired private RestClient client; + @Ignore // need s-c-lb config by properties @Test public void clientConnects() { assertTrue(client.hello().contains(" - - 4.0.0 - - org.springframework.cloud.test - spring-cloud-test-hystrix-amqp - ${spring-cloud.version} - jar - - spring-cloud-test-hystrix-amqp - Demo project for Spring Cloud - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.BUILD-SNAPSHOT - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - UTF-8 - 1.8 - 2020.0.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.cloud - spring-cloud-starter-netflix-hystrix - - - org.springframework.cloud - spring-cloud-netflix-hystrix-stream - - - org.springframework.cloud - spring-cloud-starter-stream-rabbit - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - maven-deploy-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - diff --git a/hystrix-amqp/src/main/java/demo/HystrixApplication.java b/hystrix-amqp/src/main/java/demo/HystrixApplication.java deleted file mode 100644 index 5e28a67..0000000 --- a/hystrix-amqp/src/main/java/demo/HystrixApplication.java +++ /dev/null @@ -1,37 +0,0 @@ -package demo; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; -import org.springframework.context.annotation.Bean; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@SpringBootApplication -@EnableCircuitBreaker -@RestController -public class HystrixApplication { - - @Bean - public MyService myService() { - return new MyService(); - } - - @Autowired - private MyService myService; - - @RequestMapping("/") - public String ok() { - return myService.ok(); - } - - @RequestMapping("/fail") - public String fail() { - return myService.fail(); - } - - public static void main(String[] args) { - SpringApplication.run(HystrixApplication.class, args); - } -} diff --git a/hystrix-amqp/src/main/java/demo/MyService.java b/hystrix-amqp/src/main/java/demo/MyService.java deleted file mode 100644 index ad995e3..0000000 --- a/hystrix-amqp/src/main/java/demo/MyService.java +++ /dev/null @@ -1,23 +0,0 @@ -package demo; - -import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; - -/** - * @author Spencer Gibb - */ -public class MyService { - - @HystrixCommand(fallbackMethod = "fallback") - public String ok() { - return "OK"; - } - - @HystrixCommand(fallbackMethod = "fallback") - public String fail() { - throw new RuntimeException("fail now"); - } - - public String fallback() { - return "from the fallback"; - } -} diff --git a/hystrix-amqp/src/main/resources/application.properties b/hystrix-amqp/src/main/resources/application.properties deleted file mode 100644 index 38e5ce0..0000000 --- a/hystrix-amqp/src/main/resources/application.properties +++ /dev/null @@ -1,4 +0,0 @@ -# This way you get to see the exceptions when the fallback is accessed -logging.level.com.netflix.hystrix.AbstractCommand: DEBUG -logging.level.org.springframework.integration: DEBUG -management.endpoints.web.exposure.include: * \ No newline at end of file diff --git a/hystrix-amqp/src/test/java/demo/HystrixApplicationTests.java b/hystrix-amqp/src/test/java/demo/HystrixApplicationTests.java deleted file mode 100644 index b05362d..0000000 --- a/hystrix-amqp/src/test/java/demo/HystrixApplicationTests.java +++ /dev/null @@ -1,60 +0,0 @@ -package demo; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.InputStream; -import java.net.URL; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -@DirtiesContext -public class HystrixApplicationTests { - - @LocalServerPort - int port; - - @Test - public void testOk() { - ResponseEntity response = new TestRestTemplate().getForEntity("http://localhost:" + port, String.class); - assertNotNull("response was null", response); - assertEquals("Bad status code", HttpStatus.OK, response.getStatusCode()); - assertEquals("Wrong response text", "OK", response.getBody()); - } - - @Test - public void testFallback() { - ResponseEntity response = new TestRestTemplate().getForEntity("http://localhost:" + port+"/fail", String.class); - assertNotNull("response was null", response); - assertEquals("Bad status code", HttpStatus.OK, response.getStatusCode()); - assertEquals("Wrong response text", "from the fallback", response.getBody()); - } - - @Test - public void hystrixStreamWorks() throws Exception { - String url = "http://localhost:" + port; - //you have to hit a Hystrix circuit breaker before the stream sends anything - ResponseEntity response = new TestRestTemplate().getForEntity(url, String.class); - assertEquals("bad response code", HttpStatus.OK, response.getStatusCode()); - - URL hystrixUrl = new URL(url + "/actuator/hystrix.stream"); - InputStream in = hystrixUrl.openStream(); - byte[] buffer = new byte[1024]; - in.read(buffer); - String contents = new String(buffer); - assertTrue("Wrong content: \n" + contents, contents.contains("data") || contents.contains("ping")); - in.close(); - } -} diff --git a/hystrix/README.md b/hystrix/README.md deleted file mode 100644 index ce54964..0000000 --- a/hystrix/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# About -This project is a sample of using just the Hystrix Starter. For more information see the -[Hystrix documentation](https://cloud.spring.io/spring-cloud-static/spring-cloud.html#_circuit_breaker_hystrix_clients). - -# Usage -This simple app contains two endpoints both surrounded by Hystrix circuit breakers. -See [HystrixApplication.java](https://github.com/spring-cloud-samples/tests/blob/master/hystrix/src/main/java/demo/HystrixApplication.java) for -the endpoint definitions. - -## /ok -The `/ok` endpoint just returns the String 'OK' and should actually never trip the circuit breaker since there is no -way for it to "fail". - -## /fail -The `/fail` endpoint will throw a `RuntimeException` unless the header `X-NO-FAIL` is present. If you hit the -`/fail` endpoint fast enough, the circuit will open and Hystrix will return the response from the fallback method -defined in [MyService.java](https://github.com/spring-cloud-samples/tests/blob/master/hystrix/src/main/java/demo/MyService.java#L28). -Once the circuit is open you will see the `/fail` endpoint return the string `from the fallback`. The circuit will remain -open until a successful request is made to the fail endpoint. This is where the `X-NO-FAIL` header comes in handy. If -the header is present in the request made to `/fail`, the `RuntimeException` will not be thrown. If you do this enough -while the circuit is open than the circuit will eventually close. - -## Using The Hystrix Dashboard -You can use the [Hystrix Dashboard](https://github.com/spring-cloud-samples/hystrix-dashboard) sample to visualize -the state of the circuit breakers in this application. To do this, follow the instructions in the README for the -Hystrix Dashboard sample to start the dashboard and then point it at `http://localhost:8080/hystrix.stream`. diff --git a/hystrix/pom.xml b/hystrix/pom.xml deleted file mode 100644 index 9775cf1..0000000 --- a/hystrix/pom.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - 4.0.0 - - org.springframework.cloud.test - spring-cloud-test-hystrix - ${spring-cloud.version} - jar - - spring-cloud-test-hystrix - Demo project for Spring Cloud - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.BUILD-SNAPSHOT - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - UTF-8 - 1.8 - 2020.0.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.cloud - spring-cloud-starter-netflix-hystrix - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - maven-deploy-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - diff --git a/hystrix/src/main/java/demo/HystrixApplication.java b/hystrix/src/main/java/demo/HystrixApplication.java deleted file mode 100644 index fcee781..0000000 --- a/hystrix/src/main/java/demo/HystrixApplication.java +++ /dev/null @@ -1,41 +0,0 @@ -package demo; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; -import org.springframework.context.annotation.Bean; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@SpringBootApplication -@EnableCircuitBreaker -@RestController -public class HystrixApplication { - - @Bean - public MyService myService() { - return new MyService(); - } - - @Autowired - private MyService myService; - - @RequestMapping("/") - public String ok() { - return this.myService.ok(); - } - - @RequestMapping("/fail") - public String fail(@RequestHeader(name = "X-No-Fail", required = false) String noFail) { - if (noFail != null) { - return this.myService.fail(false); - } - return this.myService.fail(true); - } - - public static void main(String[] args) { - SpringApplication.run(HystrixApplication.class, args); - } -} diff --git a/hystrix/src/main/java/demo/MyService.java b/hystrix/src/main/java/demo/MyService.java deleted file mode 100644 index 6b5d758..0000000 --- a/hystrix/src/main/java/demo/MyService.java +++ /dev/null @@ -1,31 +0,0 @@ -package demo; - -import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; - -/** - * @author Spencer Gibb - */ -public class MyService { - - @HystrixCommand(fallbackMethod = "fallback") - public String ok() { - return "OK"; - } - - @HystrixCommand(fallbackMethod = "fallback") - public String fail(boolean throwSomething) { - if(throwSomething) - throw new RuntimeException("fail now"); - else - return ""; - - } - - public String fallback() { - return "from the fallback"; - } - - public String fallback(boolean throwSomething) { - return "from the fallback"; - } -} diff --git a/hystrix/src/main/resources/application.properties b/hystrix/src/main/resources/application.properties deleted file mode 100644 index c018efa..0000000 --- a/hystrix/src/main/resources/application.properties +++ /dev/null @@ -1,3 +0,0 @@ -# This way you get to see the exceptions when the fallback is accessed -logging.level.com.netflix.hystrix.AbstractCommand: DEBUG -management.endpoints.web.exposure.include: * \ No newline at end of file diff --git a/hystrix/src/test/java/demo/HystrixApplicationTests.java b/hystrix/src/test/java/demo/HystrixApplicationTests.java deleted file mode 100644 index b05362d..0000000 --- a/hystrix/src/test/java/demo/HystrixApplicationTests.java +++ /dev/null @@ -1,60 +0,0 @@ -package demo; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.InputStream; -import java.net.URL; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -@DirtiesContext -public class HystrixApplicationTests { - - @LocalServerPort - int port; - - @Test - public void testOk() { - ResponseEntity response = new TestRestTemplate().getForEntity("http://localhost:" + port, String.class); - assertNotNull("response was null", response); - assertEquals("Bad status code", HttpStatus.OK, response.getStatusCode()); - assertEquals("Wrong response text", "OK", response.getBody()); - } - - @Test - public void testFallback() { - ResponseEntity response = new TestRestTemplate().getForEntity("http://localhost:" + port+"/fail", String.class); - assertNotNull("response was null", response); - assertEquals("Bad status code", HttpStatus.OK, response.getStatusCode()); - assertEquals("Wrong response text", "from the fallback", response.getBody()); - } - - @Test - public void hystrixStreamWorks() throws Exception { - String url = "http://localhost:" + port; - //you have to hit a Hystrix circuit breaker before the stream sends anything - ResponseEntity response = new TestRestTemplate().getForEntity(url, String.class); - assertEquals("bad response code", HttpStatus.OK, response.getStatusCode()); - - URL hystrixUrl = new URL(url + "/actuator/hystrix.stream"); - InputStream in = hystrixUrl.openStream(); - byte[] buffer = new byte[1024]; - in.read(buffer); - String contents = new String(buffer); - assertTrue("Wrong content: \n" + contents, contents.contains("data") || contents.contains("ping")); - in.close(); - } -} diff --git a/oauth2-zuul/README.md b/oauth2-zuul/README.md deleted file mode 100644 index 3abb2ae..0000000 --- a/oauth2-zuul/README.md +++ /dev/null @@ -1 +0,0 @@ -This project is a sample of a client application with OAuth2 and Zuul \ No newline at end of file diff --git a/oauth2-zuul/pom.xml b/oauth2-zuul/pom.xml deleted file mode 100644 index b199909..0000000 --- a/oauth2-zuul/pom.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - 4.0.0 - - org.springframework.cloud.test - spring-cloud-test-oauth2-zuul - ${spring-cloud.version} - jar - - spring-cloud-test-oauth2-zuul - Demo project for Spring Cloud - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.BUILD-SNAPSHOT - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - UTF-8 - 1.8 - 2020.0.0-SNAPSHOT - - - - - org.springframework.cloud - spring-cloud-starter-oauth2 - - - org.springframework.cloud - spring-cloud-starter-netflix-zuul - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - maven-deploy-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - diff --git a/oauth2-zuul/src/main/java/demo/ZuulApplication.java b/oauth2-zuul/src/main/java/demo/ZuulApplication.java deleted file mode 100644 index 2684bb2..0000000 --- a/oauth2-zuul/src/main/java/demo/ZuulApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package demo; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -// import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; - -@SpringBootApplication -// @EnableOAuth2Sso -// FIXME boot 2.0.0 spring-security 5.0 missing oauth -public class ZuulApplication { - - public static void main(String[] args) { - SpringApplication.run(ZuulApplication.class, args); - } -} diff --git a/oauth2-zuul/src/main/resources/application.properties b/oauth2-zuul/src/main/resources/application.properties deleted file mode 100644 index 7999064..0000000 --- a/oauth2-zuul/src/main/resources/application.properties +++ /dev/null @@ -1,6 +0,0 @@ -security.oauth2.client.clientId: acme -security.oauth2.client.clientSecret: acmesecret -security.oauth2.client.accessTokenUri: https://example.com -security.oauth2.client.userAuthorizationUri: https://example.com -security.oauth2.resource.user-info-uri: https://example.com -# debug: \ No newline at end of file diff --git a/oauth2-zuul/src/test/java/demo/ZuulApplicationTests.java b/oauth2-zuul/src/test/java/demo/ZuulApplicationTests.java deleted file mode 100644 index 5e2b994..0000000 --- a/oauth2-zuul/src/test/java/demo/ZuulApplicationTests.java +++ /dev/null @@ -1,33 +0,0 @@ -package demo; - -import static org.junit.Assert.assertEquals; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) -public class ZuulApplicationTests { - - private TestRestTemplate restTemplate = new TestRestTemplate(); - - @Value("${local.server.port}") - int port; - - @Test - @Ignore - public void useRestTemplate() throws Exception { - ResponseEntity entity = this.restTemplate.getForEntity("http://localhost:" + this.port, String.class); - assertEquals(HttpStatus.FOUND, entity.getStatusCode()); - assertEquals("http://localhost:" + this.port + "/login", entity.getHeaders().getLocation().toString()); - } - -} diff --git a/pom.xml b/pom.xml index 457cbf1..14bb581 100644 --- a/pom.xml +++ b/pom.xml @@ -33,25 +33,16 @@ feign feign-eager-instantiation feign-eureka - + noweb - - - + + sleuth stream-bus - vanilla zipkin - diff --git a/turbine-amqp/docker-compose.yml b/turbine-amqp/docker-compose.yml deleted file mode 100644 index 1a53d6e..0000000 --- a/turbine-amqp/docker-compose.yml +++ /dev/null @@ -1,5 +0,0 @@ -rabbitmq: - image: rabbitmq:management - ports: - - "5672:5672" - - "15672:15672" diff --git a/turbine-amqp/pom.xml b/turbine-amqp/pom.xml deleted file mode 100644 index a125200..0000000 --- a/turbine-amqp/pom.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - 4.0.0 - - org.springframework.cloud.test - spring-cloud-test-turbine-amqp - ${spring-cloud.version} - jar - - spring-cloud-test-turbine-amqp - Demo project for Spring Cloud - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.BUILD-SNAPSHOT - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - UTF-8 - demo.DemoApplication - 1.8 - 2020.0.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.cloud - spring-cloud-starter-netflix-turbine-stream - - - org.springframework.cloud - spring-cloud-stream-binder-rabbit - - - - io.netty - netty-handler - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - maven-deploy-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - diff --git a/turbine-amqp/src/main/java/demo/TurbineStreamApplication.java b/turbine-amqp/src/main/java/demo/TurbineStreamApplication.java deleted file mode 100644 index 059815e..0000000 --- a/turbine-amqp/src/main/java/demo/TurbineStreamApplication.java +++ /dev/null @@ -1,16 +0,0 @@ -package demo; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.netflix.turbine.stream.EnableTurbineStream; - -@SpringBootApplication -@EnableDiscoveryClient -@EnableTurbineStream -public class TurbineStreamApplication { - - public static void main(String[] args) { - SpringApplication.run(TurbineStreamApplication.class, args); - } -} diff --git a/turbine-amqp/src/main/resources/application.properties b/turbine-amqp/src/main/resources/application.properties deleted file mode 100644 index 6449849..0000000 --- a/turbine-amqp/src/main/resources/application.properties +++ /dev/null @@ -1,4 +0,0 @@ -server.port: 8989 -spring.application.name: turbine -turbine.appConfig: simple -turbine.aggregator.clusterConfig: SIMPLE diff --git a/turbine-amqp/src/test/java/demo/TurbineStreamApplicationTests.java b/turbine-amqp/src/test/java/demo/TurbineStreamApplicationTests.java deleted file mode 100644 index b4dd1e9..0000000 --- a/turbine-amqp/src/test/java/demo/TurbineStreamApplicationTests.java +++ /dev/null @@ -1,42 +0,0 @@ -package demo; - -import static org.junit.Assert.assertTrue; - -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.cloud.client.discovery.DiscoveryClient; -import org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClient; -import org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClient; -import org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -@DirtiesContext -public class TurbineStreamApplicationTests { - - @Autowired - DiscoveryClient discoveryClient; - - @Test - public void contextLoads() { - } - - @Test - public void discoveryClientIsEureka() { - assertTrue("discoveryClient is wrong type " + discoveryClient.getClass(), discoveryClient instanceof CompositeDiscoveryClient); - CompositeDiscoveryClient compositeDiscoveryClient = (CompositeDiscoveryClient)discoveryClient; - assertTrue("composite discovery client should be composed of Eureka and Simple Discovery client's" - , compositeDiscoveryClient.getDiscoveryClients().size() == 2); - - assertTrue("the composed discovery client should have a EurekaDiscoveryClient with a higher precedence ", - compositeDiscoveryClient.getDiscoveryClients().get(0) instanceof EurekaDiscoveryClient); - - assertTrue("the composed discovery client should have a SimpleDiscoveryClient with a lower precedence ", - compositeDiscoveryClient.getDiscoveryClients().get(1) instanceof SimpleDiscoveryClient); - } - -} diff --git a/turbine-amqp/src/test/resources/eureka.properties b/turbine-amqp/src/test/resources/eureka.properties deleted file mode 100644 index a0e3d7f..0000000 --- a/turbine-amqp/src/test/resources/eureka.properties +++ /dev/null @@ -1,4 +0,0 @@ -server.port: 8761 -spring.application.name: eureka -eureka.client.registerWithEureka=false -eureka.client.fetchRegistry=false \ No newline at end of file diff --git a/turbine-amqp/src/test/resources/simple.properties b/turbine-amqp/src/test/resources/simple.properties deleted file mode 100644 index ec7a5fc..0000000 --- a/turbine-amqp/src/test/resources/simple.properties +++ /dev/null @@ -1,2 +0,0 @@ -server.port: 8080 -spring.application.name: simple diff --git a/turbine/pom.xml b/turbine/pom.xml deleted file mode 100644 index 01f7b2b..0000000 --- a/turbine/pom.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - 4.0.0 - - org.springframework.cloud.test - spring-cloud-test-turbine - ${spring-cloud.version} - jar - - spring-cloud-test-turbine - Demo project for Spring Cloud - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.BUILD-SNAPSHOT - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - UTF-8 - demo.DemoApplication - 1.8 - 2020.0.0-SNAPSHOT - - - - - org.springframework.cloud - spring-cloud-starter-netflix-turbine - - - org.springframework.cloud - spring-cloud-starter-netflix-hystrix - test - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-server - test - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - maven-deploy-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - diff --git a/turbine/src/main/java/demo/TurbineApplication.java b/turbine/src/main/java/demo/TurbineApplication.java deleted file mode 100644 index 4db13e3..0000000 --- a/turbine/src/main/java/demo/TurbineApplication.java +++ /dev/null @@ -1,14 +0,0 @@ -package demo; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.turbine.EnableTurbine; - -@SpringBootApplication -@EnableTurbine -public class TurbineApplication { - - public static void main(String[] args) { - SpringApplication.run(TurbineApplication.class, args); - } -} diff --git a/turbine/src/main/resources/application.yml b/turbine/src/main/resources/application.yml deleted file mode 100644 index 85116f5..0000000 --- a/turbine/src/main/resources/application.yml +++ /dev/null @@ -1,11 +0,0 @@ -server: - port: 8989 -spring: - application: - name: turbine -turbine: - appConfig: simple,other - aggregator: - clusterConfig: MAIN - clusterNameExpression: metadata['cluster'] - combineHostPort: true \ No newline at end of file diff --git a/turbine/src/test/java/apps/EurekaServerApplication.java b/turbine/src/test/java/apps/EurekaServerApplication.java deleted file mode 100644 index 1983ade..0000000 --- a/turbine/src/test/java/apps/EurekaServerApplication.java +++ /dev/null @@ -1,19 +0,0 @@ -package apps; - -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; -import org.springframework.context.annotation.Configuration; - -@Configuration -@EnableAutoConfiguration -@EnableEurekaServer -public class EurekaServerApplication { - - public static void main(String[] args) { - new SpringApplicationBuilder(EurekaServerApplication.class).properties( - "spring.config.name:eureka", "logging.level.com.netflix.discovery:OFF") - .run(args); - } - -} diff --git a/turbine/src/test/java/apps/OtherApplication.java b/turbine/src/test/java/apps/OtherApplication.java deleted file mode 100644 index 6fffaa3..0000000 --- a/turbine/src/test/java/apps/OtherApplication.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2014-2015 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 - * - * https://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 apps; - -import javax.servlet.http.HttpSession; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; - -@Configuration -@EnableAutoConfiguration -@EnableDiscoveryClient -@EnableCircuitBreaker -@RestController -public class OtherApplication { - - @Autowired - private HelloService service; - - @RequestMapping("/") - public String hello() { - return this.service.hello(); - } - - @RequestMapping("/session") - public String session(HttpSession session) { - return session.getId(); - } - - @RequestMapping("/fail") - public String fail() { - return this.service.fail(); - } - - public static void main(String[] args) { - new SpringApplicationBuilder(OtherApplication.class).properties( - "spring.config.name:other").run(args); - } - - @Service - public static class HelloService { - - @HystrixCommand(fallbackMethod="fallback") - public String hello() { - return "Hello World"; - } - - @HystrixCommand(fallbackMethod="fallback") - public String fail() { - throw new RuntimeException("Planned"); - } - - public String fallback() { - return "Fallback"; - } - - } - -} diff --git a/turbine/src/test/java/apps/SimpleApplication.java b/turbine/src/test/java/apps/SimpleApplication.java deleted file mode 100644 index 9469361..0000000 --- a/turbine/src/test/java/apps/SimpleApplication.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2014-2015 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 - * - * https://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 apps; - -import javax.servlet.http.HttpSession; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; - -@Configuration -@EnableAutoConfiguration -@EnableDiscoveryClient -@EnableCircuitBreaker -@RestController -public class SimpleApplication { - - @Autowired - private HelloService service; - - @RequestMapping("/") - public String hello() { - return this.service.hello(); - } - - @RequestMapping("/session") - public String session(HttpSession session) { - return session.getId(); - } - - @RequestMapping("/fail") - public String fail() { - return this.service.fail(); - } - - public static void main(String[] args) { - new SpringApplicationBuilder(SimpleApplication.class).properties( - "spring.config.name:simple").run(args); - } - - @Service - public static class HelloService { - - @HystrixCommand(fallbackMethod="fallback") - public String hello() { - return "Hello World"; - } - - @HystrixCommand(fallbackMethod="fallback") - public String fail() { - throw new RuntimeException("Planned"); - } - - public String fallback() { - return "Fallback"; - } - - } - -} diff --git a/turbine/src/test/java/demo/TurbineApplicationTests.java b/turbine/src/test/java/demo/TurbineApplicationTests.java deleted file mode 100644 index cfdba6b..0000000 --- a/turbine/src/test/java/demo/TurbineApplicationTests.java +++ /dev/null @@ -1,31 +0,0 @@ -package demo; - -import static org.junit.Assert.assertTrue; - -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.cloud.client.discovery.DiscoveryClient; -import org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClient; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -@DirtiesContext -public class TurbineApplicationTests { - - @Autowired - DiscoveryClient discoveryClient; - - @Test - public void contextLoads() { - } - - @Test - public void discoveryClientIsEureka() { - assertTrue("discoveryClient is wrong type", discoveryClient instanceof CompositeDiscoveryClient); - } - -} diff --git a/turbine/src/test/resources/eureka.properties b/turbine/src/test/resources/eureka.properties deleted file mode 100644 index a0e3d7f..0000000 --- a/turbine/src/test/resources/eureka.properties +++ /dev/null @@ -1,4 +0,0 @@ -server.port: 8761 -spring.application.name: eureka -eureka.client.registerWithEureka=false -eureka.client.fetchRegistry=false \ No newline at end of file diff --git a/turbine/src/test/resources/other.properties b/turbine/src/test/resources/other.properties deleted file mode 100644 index d1bfb70..0000000 --- a/turbine/src/test/resources/other.properties +++ /dev/null @@ -1,3 +0,0 @@ -server.port: 8081 -spring.application.name: other -eureka.instance.metadata-map.cluster: MAIN \ No newline at end of file diff --git a/turbine/src/test/resources/simple.properties b/turbine/src/test/resources/simple.properties deleted file mode 100644 index 9be4e14..0000000 --- a/turbine/src/test/resources/simple.properties +++ /dev/null @@ -1,3 +0,0 @@ -server.port: 8080 -spring.application.name: simple -eureka.instance.metadata-map.cluster: MAIN \ No newline at end of file diff --git a/zuul-config-discovery/README.md b/zuul-config-discovery/README.md deleted file mode 100755 index 48a40dd..0000000 --- a/zuul-config-discovery/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Test with zuul server, eureka and config server. Config server is located by discovery. - -Test that zuul server updates routes when new routes are added (at least doesn't fail with a stack overflow exception) diff --git a/zuul-config-discovery/pom.xml b/zuul-config-discovery/pom.xml deleted file mode 100755 index d661373..0000000 --- a/zuul-config-discovery/pom.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - 4.0.0 - - org.springframework.cloud.test - spring-cloud-test-zuul-config-discovery - ${spring-cloud.version} - jar - - spring-cloud-test-zuul-config-discovery - Demo project for Spring Cloud - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.BUILD-SNAPSHOT - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - UTF-8 - 1.8 - 2020.0.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - - - org.springframework.cloud - spring-cloud-starter-netflix-zuul - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - maven-deploy-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/libs-release-local - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - - diff --git a/zuul-config-discovery/src/main/java/demo/ZuulConfigDiscoveryApplication.java b/zuul-config-discovery/src/main/java/demo/ZuulConfigDiscoveryApplication.java deleted file mode 100755 index 032514a..0000000 --- a/zuul-config-discovery/src/main/java/demo/ZuulConfigDiscoveryApplication.java +++ /dev/null @@ -1,17 +0,0 @@ -package demo; - -import org.springframework.boot.WebApplicationType; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.netflix.zuul.EnableZuulProxy; - -@SpringBootApplication -@EnableZuulProxy -public class ZuulConfigDiscoveryApplication { - - public static void main(String[] args) { - new SpringApplicationBuilder(ZuulConfigDiscoveryApplication.class) - .web(WebApplicationType.SERVLET).run(args); - } - -} diff --git a/zuul-config-discovery/src/main/resources/application.yml b/zuul-config-discovery/src/main/resources/application.yml deleted file mode 100644 index 94ce552..0000000 --- a/zuul-config-discovery/src/main/resources/application.yml +++ /dev/null @@ -1,29 +0,0 @@ -info: - component: Zuul Server - -endpoints: - restart: - enabled: true - shutdown: - enabled: true - sensitive: false - -logging: - level: - org.springframework.security: DEBUG - org.springframework.web: DEBUG - org.springframework.boot: INFO - #com.netflix.discovery: 'OFF' - ROOT: INFO - -eureka: - instance: - leaseRenewalIntervalInSeconds: 10 - statusPageUrlPath: /admin/info - healthCheckUrlPath: /admin/health - -management: - port: ${MGMT_SERVER_PORT:8766} - -server: - port: ${SERVER_PORT:8765} diff --git a/zuul-config-discovery/src/main/resources/bootstrap.yml b/zuul-config-discovery/src/main/resources/bootstrap.yml deleted file mode 100755 index 11e3fd2..0000000 --- a/zuul-config-discovery/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,15 +0,0 @@ -spring: - application: - name: zuulConfigDiscoveryTest - cloud: - config: - username: user - password: password - failFast: true - discovery: - enabled: true - -eureka: - client: - serviceUrl: - defaultZone: https://user::password@localhost:8761/eureka/ diff --git a/zuul-config-discovery/src/test/java/demo/ZuulConfigDiscoveryApplicationTests.java b/zuul-config-discovery/src/test/java/demo/ZuulConfigDiscoveryApplicationTests.java deleted file mode 100644 index c44ac10..0000000 --- a/zuul-config-discovery/src/test/java/demo/ZuulConfigDiscoveryApplicationTests.java +++ /dev/null @@ -1,23 +0,0 @@ -package demo; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -@DirtiesContext -public class ZuulConfigDiscoveryApplicationTests { - - @LocalServerPort - private int port; - - @Test - public void contextLoads() { - } - -} diff --git a/zuul-proxy-eureka/pom.xml b/zuul-proxy-eureka/pom.xml deleted file mode 100644 index 1661b08..0000000 --- a/zuul-proxy-eureka/pom.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - 4.0.0 - - org.springframework.cloud.test - spring-cloud-test-zuul-proxy-eureka - ${spring-cloud.version} - jar - - spring-cloud-test-zuul-proxy-eureka - Demo project for Spring Cloud - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.BUILD-SNAPSHOT - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - UTF-8 - demo.DemoApplication - 1.8 - 2020.0.0-SNAPSHOT - - - - - org.springframework.cloud - spring-cloud-starter-netflix-zuul - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - maven-deploy-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - diff --git a/zuul-proxy-eureka/src/main/java/demo/ZuulProxyEurekaApplication.java b/zuul-proxy-eureka/src/main/java/demo/ZuulProxyEurekaApplication.java deleted file mode 100644 index d0f845e..0000000 --- a/zuul-proxy-eureka/src/main/java/demo/ZuulProxyEurekaApplication.java +++ /dev/null @@ -1,14 +0,0 @@ -package demo; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.zuul.EnableZuulProxy; - -@SpringBootApplication -@EnableZuulProxy -public class ZuulProxyEurekaApplication { - - public static void main(String[] args) { - SpringApplication.run(ZuulProxyEurekaApplication.class, args); - } -} diff --git a/zuul-proxy-eureka/src/main/resources/application.properties b/zuul-proxy-eureka/src/main/resources/application.properties deleted file mode 100644 index 9923b36..0000000 --- a/zuul-proxy-eureka/src/main/resources/application.properties +++ /dev/null @@ -1,3 +0,0 @@ -debug: true -spring.application.name: zuulproxy -server.port: 9900 \ No newline at end of file diff --git a/zuul-proxy-eureka/src/test/java/demo/ZuulProxyEurekaApplicationTests.java b/zuul-proxy-eureka/src/test/java/demo/ZuulProxyEurekaApplicationTests.java deleted file mode 100644 index bcbec8b..0000000 --- a/zuul-proxy-eureka/src/test/java/demo/ZuulProxyEurekaApplicationTests.java +++ /dev/null @@ -1,34 +0,0 @@ -package demo; - -import static org.junit.Assert.assertTrue; - -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.cloud.client.discovery.DiscoveryClient; -import org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClient; -import org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -@DirtiesContext -public class ZuulProxyEurekaApplicationTests { - - @Autowired - DiscoveryClient discoveryClient; - - @Test - public void contextLoads() { - } - - @Test - public void discoveryClientIsEureka() { - assertTrue("discoveryClient is wrong type", discoveryClient instanceof CompositeDiscoveryClient); - assertTrue("composite discovery client should compose Eureka Discovery Client with highest precedence", - ((CompositeDiscoveryClient)discoveryClient).getDiscoveryClients().get(0) instanceof EurekaDiscoveryClient); - } - -} diff --git a/zuul-proxy/pom.xml b/zuul-proxy/pom.xml deleted file mode 100644 index a4c5269..0000000 --- a/zuul-proxy/pom.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - 4.0.0 - - org.springframework.cloud.test - spring-cloud-test-zuul-proxy - ${spring-cloud.version} - jar - - spring-cloud-test-zuul-proxy - Demo project for Spring Cloud - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.BUILD-SNAPSHOT - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - UTF-8 - demo.DemoApplication - 1.8 - 2020.0.0-SNAPSHOT - - - - - org.springframework.cloud - spring-cloud-starter-netflix-zuul - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - maven-deploy-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - diff --git a/zuul-proxy/src/main/java/demo/ZuulProxyApplication.java b/zuul-proxy/src/main/java/demo/ZuulProxyApplication.java deleted file mode 100644 index eead11b..0000000 --- a/zuul-proxy/src/main/java/demo/ZuulProxyApplication.java +++ /dev/null @@ -1,28 +0,0 @@ -package demo; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.zuul.EnableZuulProxy; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -@SpringBootApplication -@EnableZuulProxy -@RestController -public class ZuulProxyApplication { - - @RequestMapping("/good") - public String good(@RequestParam(required = false) String value) { - return "GOOD" + (value == null ? "" : " " + value) + "!"; - } - - @RequestMapping("/good/stuff") - public String stuff() { - return "STUFF!"; - } - - public static void main(String[] args) { - SpringApplication.run(ZuulProxyApplication.class, args); - } -} diff --git a/zuul-proxy/src/main/resources/application.properties b/zuul-proxy/src/main/resources/application.properties deleted file mode 100644 index b35efb1..0000000 --- a/zuul-proxy/src/main/resources/application.properties +++ /dev/null @@ -1,15 +0,0 @@ -spring.application.name: zuulproxy -server.port: 9900 -zuul.ignored-patterns: /missing -zuul.routes.admin.path: /admin/** -zuul.routes.admin.url: forward:/ -zuul.routes.good.path: /good/** -zuul.routes.good.url: forward:/good -zuul.routes.bad.path: /bad/** -zuul.routes.bad.url: http://localhost:7777 -zuul.routes.gh.path: /gh/** -zuul.routes.gh.url: https://github.com -zuul.routes.gh.sensitive-headers: Set-Cookie,Cookie -#zuul.routes.ui.path: /** -#zuul.routes.ui.url: http://localhost:8080 -logging.level.org.springframework.web: DEBUG \ No newline at end of file diff --git a/zuul-proxy/src/test/java/apps/UiApplication.java b/zuul-proxy/src/test/java/apps/UiApplication.java deleted file mode 100644 index e4a4d0e..0000000 --- a/zuul-proxy/src/test/java/apps/UiApplication.java +++ /dev/null @@ -1,43 +0,0 @@ -package apps; - -import java.io.IOException; - -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.servlet.support.ServletUriComponentsBuilder; - -@SpringBootApplication -@RestController -public class UiApplication { - - @RequestMapping("/") - public String home(@RequestParam(required = false) String value) { - return "Hello " + (value == null ? "World" : value); - } - - @RequestMapping(value = "/upload", method = RequestMethod.GET) - public String upload() { - ServletUriComponentsBuilder builder = ServletUriComponentsBuilder - .fromCurrentContextPath(); - return "" - + "
" - + "File to upload: " - + "
" + ""; - } - - @RequestMapping(value = "/upload", method = RequestMethod.POST) - public String accept(@RequestParam MultipartFile file) throws IOException { - return new String(file.getBytes()); - } - - public static void main(String[] args) { - new SpringApplicationBuilder(UiApplication.class) - .properties("spring.config.name:ui").run(args); - } -} diff --git a/zuul-proxy/src/test/java/demo/ZuulProxyApplicationTests.java b/zuul-proxy/src/test/java/demo/ZuulProxyApplicationTests.java deleted file mode 100644 index d9789b7..0000000 --- a/zuul-proxy/src/test/java/demo/ZuulProxyApplicationTests.java +++ /dev/null @@ -1,57 +0,0 @@ -package demo; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.cloud.client.discovery.DiscoveryClient; -import org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClient; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) -@DirtiesContext -public class ZuulProxyApplicationTests { - - @Autowired - DiscoveryClient discoveryClient; - - @LocalServerPort - int port; - - private TestRestTemplate restTemplate = new TestRestTemplate(); - - @Test - public void ignoredPatternMissing() { - ResponseEntity result = this.restTemplate.getForEntity("http://localhost:"+this.port +"/missing", String.class); - assertEquals(HttpStatus.NOT_FOUND, result.getStatusCode()); - } - - @Test - public void forwardedPatternGood() { - ResponseEntity result = this.restTemplate.getForEntity("http://localhost:"+this.port +"/good", String.class); - assertEquals(HttpStatus.OK, result.getStatusCode()); - assertEquals("GOOD!", result.getBody()); - } - - @Test - public void forwardedPatternGoodWithPath() { - ResponseEntity result = this.restTemplate.getForEntity("http://localhost:"+this.port +"/good/stuff", String.class); - assertEquals(HttpStatus.OK, result.getStatusCode()); - assertEquals("STUFF!", result.getBody()); - } - - @Test - public void discoveryClientIsComposite() { - assertTrue("discoveryClient is wrong type", this.discoveryClient instanceof CompositeDiscoveryClient); - } -} diff --git a/zuul-proxy/src/test/resources/file.txt b/zuul-proxy/src/test/resources/file.txt deleted file mode 100644 index 44ea73f..0000000 --- a/zuul-proxy/src/test/resources/file.txt +++ /dev/null @@ -1,14 +0,0 @@ ---FOO -Content-Disposition: form-data; name="file"; filename="foo.txt" -Content-Type: text/plain - -POST this file to the proxy to test multipart file data: - -$ curl -v -H "Content-Type: multipart/form-data; boundary=FOO" --data-binary @thisfile - - ---FOO -Content-Disposition: form-data; name="name" - -Dave ---FOO-- diff --git a/zuul-proxy/src/test/resources/ui.properties b/zuul-proxy/src/test/resources/ui.properties deleted file mode 100644 index 04b145f..0000000 --- a/zuul-proxy/src/test/resources/ui.properties +++ /dev/null @@ -1,3 +0,0 @@ -spring.application.name: ui -multipart.maxFileSize: 128KB -multipart.maxRequestSize: 128KB \ No newline at end of file diff --git a/zuul/README.md b/zuul/README.md deleted file mode 100755 index 7c781b8..0000000 --- a/zuul/README.md +++ /dev/null @@ -1 +0,0 @@ -Test with zuul server only. No proxy and no eureka. diff --git a/zuul/pom.xml b/zuul/pom.xml deleted file mode 100644 index 5219698..0000000 --- a/zuul/pom.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - 4.0.0 - - org.springframework.cloud.test - spring-cloud-test-zuul - ${spring-cloud.version} - jar - - spring-cloud-test-zuul - Demo project for Spring Cloud - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.BUILD-SNAPSHOT - - - - - UTF-8 - demo.DemoApplication - 1.8 - 2020.0.0-SNAPSHOT - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.cloud - spring-cloud-starter-netflix-zuul - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - maven-deploy-plugin - - true - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - diff --git a/zuul/src/main/java/demo/ZuulApplication.java b/zuul/src/main/java/demo/ZuulApplication.java deleted file mode 100644 index 854fa99..0000000 --- a/zuul/src/main/java/demo/ZuulApplication.java +++ /dev/null @@ -1,64 +0,0 @@ -package demo; - -import javax.servlet.http.HttpServletResponse; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.zuul.EnableZuulServer; -import org.springframework.stereotype.Component; - -import com.netflix.zuul.ZuulFilter; -import com.netflix.zuul.context.RequestContext; - -@SpringBootApplication -@EnableZuulServer -public class ZuulApplication { - - public static void main(String[] args) { - SpringApplication.run(ZuulApplication.class, args); - } -} - -@Component -class SampleStaticResponseFilter extends ZuulFilter { - - private static final String URI = "/static"; - - @Override - public String filterType() { - return "route"; - } - - @Override - public int filterOrder() { - return 0; - } - - @Override - public boolean shouldFilter() { - String path = RequestContext.getCurrentContext().getRequest().getRequestURI(); - if (checkPath(path)) - return true; - if (checkPath("/" + path)) - return true; - return false; - } - - private boolean checkPath(String path) { - return URI.equals(path); - } - - @Override - public Object run() { - RequestContext ctx = RequestContext.getCurrentContext(); - // Set the default response code for static filters to be 200 - ctx.setResponseStatusCode(HttpServletResponse.SC_OK); - // first StaticResponseFilter instance to match wins, others do not set body - // and/or status - if (ctx.getResponseBody() == null) { - ctx.setResponseBody("Hello World"); - ctx.setSendZuulResponse(false); - } - return null; - } -} \ No newline at end of file diff --git a/zuul/src/main/resources/application.properties b/zuul/src/main/resources/application.properties deleted file mode 100644 index b740798..0000000 --- a/zuul/src/main/resources/application.properties +++ /dev/null @@ -1,3 +0,0 @@ -spring.application.name: zuul -server.port: 9900 -zuul.routes.ui.path: /static/** \ No newline at end of file diff --git a/zuul/src/test/java/demo/ZuulApplicationTests.java b/zuul/src/test/java/demo/ZuulApplicationTests.java deleted file mode 100644 index 9201309..0000000 --- a/zuul/src/test/java/demo/ZuulApplicationTests.java +++ /dev/null @@ -1,40 +0,0 @@ -package demo; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.cloud.client.discovery.DiscoveryClient; -import org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClient; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) -@DirtiesContext -public class ZuulApplicationTests { - - @Autowired - DiscoveryClient discoveryClient; - - @LocalServerPort - int port; - - @Test - public void contextLoads() { - assertEquals("Hello World", new TestRestTemplate() - .getForObject("http://localhost:" + this.port + "/static", String.class)); - } - - @Test - public void discoveryClientIsComposite() { - assertTrue("discoveryClient is wrong type", - this.discoveryClient instanceof CompositeDiscoveryClient); - } -} diff --git a/zuul/src/test/resources/file.txt b/zuul/src/test/resources/file.txt deleted file mode 100644 index 44ea73f..0000000 --- a/zuul/src/test/resources/file.txt +++ /dev/null @@ -1,14 +0,0 @@ ---FOO -Content-Disposition: form-data; name="file"; filename="foo.txt" -Content-Type: text/plain - -POST this file to the proxy to test multipart file data: - -$ curl -v -H "Content-Type: multipart/form-data; boundary=FOO" --data-binary @thisfile - - ---FOO -Content-Disposition: form-data; name="name" - -Dave ---FOO-- diff --git a/zuul/src/test/resources/ui.properties b/zuul/src/test/resources/ui.properties deleted file mode 100644 index 04b145f..0000000 --- a/zuul/src/test/resources/ui.properties +++ /dev/null @@ -1,3 +0,0 @@ -spring.application.name: ui -multipart.maxFileSize: 128KB -multipart.maxRequestSize: 128KB \ No newline at end of file