Polish test

parent 14c1d461
......@@ -17,6 +17,9 @@
package org.springframework.cloud.netflix.zuul.filters.route;
import com.netflix.zuul.context.RequestContext;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
......@@ -34,11 +37,21 @@ import java.util.concurrent.atomic.AtomicInteger;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(value = { "zuul.routes.myroute.service-id=eager",
@SpringBootTest(properties = { "zuul.routes.eagerroute.service-id=eager",
"zuul.ribbon.eager-load.enabled=true" })
@DirtiesContext
public class EagerLoadOfZuulConfigurationTests {
@Before
public void setTestRequestContext() {
RequestContext context = new RequestContext();
RequestContext.testSetCurrentContext(context);
}
@After
public void clear() {
RequestContext.getCurrentContext().clear();
}
@Test
public void testEagerLoading() {
// Child context FooConfig should have been eagerly instantiated..
......
......@@ -19,6 +19,7 @@ package org.springframework.cloud.netflix.zuul.filters.route;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
......@@ -46,14 +47,21 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = RANDOM_PORT, value = {
"zuul.routes.myroute.service-id=lazy", "zuul.routes.myroute.path=/lazy/**" })
@SpringBootTest(webEnvironment = RANDOM_PORT, properties = {
"zuul.routes.lazyroute.service-id=lazy", "zuul.routes.lazyroute.path=/lazy/**",
"zuul.ribbon.eager-load.enabled=false"})
@DirtiesContext
public class LazyLoadOfZuulConfigurationTests {
@LocalServerPort
protected int port;
@Before
public void setTestRequestContext() {
RequestContext context = new RequestContext();
RequestContext.testSetCurrentContext(context);
}
@After
public void clear() {
RequestContext.getCurrentContext().clear();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment