Commit e7331098 by Spencer Gibb

change protected and package scope fields to private

fixes gh-149
parent 84554725
...@@ -36,13 +36,13 @@ public abstract class ServletWrappingEndpoint implements InitializingBean, ...@@ -36,13 +36,13 @@ public abstract class ServletWrappingEndpoint implements InitializingBean,
// TODO: move to spring-boot? // TODO: move to spring-boot?
protected String path; private String path;
protected boolean sensitive; private boolean sensitive;
protected boolean enabled = true; private boolean enabled = true;
protected final ServletWrappingController controller = new ServletWrappingController(); private final ServletWrappingController controller = new ServletWrappingController();
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
...@@ -75,6 +75,13 @@ public abstract class ServletWrappingEndpoint implements InitializingBean, ...@@ -75,6 +75,13 @@ public abstract class ServletWrappingEndpoint implements InitializingBean,
return this.controller.handleRequest(request, response); return this.controller.handleRequest(request, response);
} }
public boolean isEnabled() {
return enabled;
}
public ServletWrappingController getController() {
return controller;
}
@Override @Override
public String getPath() { public String getPath() {
return this.path; return this.path;
......
...@@ -42,7 +42,7 @@ import com.netflix.discovery.converters.XmlXStream; ...@@ -42,7 +42,7 @@ import com.netflix.discovery.converters.XmlXStream;
public class EurekaClientAutoConfiguration { public class EurekaClientAutoConfiguration {
@Autowired @Autowired
ApplicationContext context; private ApplicationContext context;
@PostConstruct @PostConstruct
public void init() { public void init() {
......
...@@ -90,7 +90,7 @@ public class EurekaDiscoveryClient implements DiscoveryClient { ...@@ -90,7 +90,7 @@ public class EurekaDiscoveryClient implements DiscoveryClient {
} }
static class EurekaServiceInstance implements ServiceInstance { static class EurekaServiceInstance implements ServiceInstance {
InstanceInfo instance; private InstanceInfo instance;
EurekaServiceInstance(InstanceInfo instance) { EurekaServiceInstance(InstanceInfo instance) {
this.instance = instance; this.instance = instance;
......
...@@ -41,31 +41,31 @@ public class FeignConfiguration { ...@@ -41,31 +41,31 @@ public class FeignConfiguration {
ConfigurableEnvironmentConfiguration envConfig; // FIXME: howto enforce this? ConfigurableEnvironmentConfiguration envConfig; // FIXME: howto enforce this?
@Autowired @Autowired
Decoder decoder; private Decoder decoder;
@Autowired @Autowired
Encoder encoder; private Encoder encoder;
@Autowired @Autowired
Logger logger; private Logger logger;
@Autowired @Autowired
Contract contract; private Contract contract;
@Autowired(required = false) @Autowired(required = false)
Logger.Level logLevel; private Logger.Level logLevel;
@Autowired(required = false) @Autowired(required = false)
Retryer retryer; private Retryer retryer;
@Autowired(required = false) @Autowired(required = false)
ErrorDecoder errorDecoder; private ErrorDecoder errorDecoder;
@Autowired(required = false) @Autowired(required = false)
Request.Options options; private Request.Options options;
@Autowired(required = false) @Autowired(required = false)
Client ribbonClient; private Client ribbonClient;
protected Feign.Builder feign() { protected Feign.Builder feign() {
Feign.Builder builder = Feign.builder() Feign.Builder builder = Feign.builder()
......
...@@ -43,7 +43,7 @@ import static org.springframework.cloud.netflix.feign.FeignUtils.getHttpHeaders; ...@@ -43,7 +43,7 @@ import static org.springframework.cloud.netflix.feign.FeignUtils.getHttpHeaders;
public class SpringDecoder implements Decoder { public class SpringDecoder implements Decoder {
@Autowired @Autowired
Provider<HttpMessageConverters> messageConverters; private Provider<HttpMessageConverters> messageConverters;
public SpringDecoder() { public SpringDecoder() {
} }
......
...@@ -48,7 +48,7 @@ public class SpringEncoder implements Encoder { ...@@ -48,7 +48,7 @@ public class SpringEncoder implements Encoder {
private static final Logger logger = LoggerFactory.getLogger(SpringEncoder.class); private static final Logger logger = LoggerFactory.getLogger(SpringEncoder.class);
@Autowired @Autowired
Provider<HttpMessageConverters> messageConverters; private Provider<HttpMessageConverters> messageConverters;
@Override @Override
public void encode(Object requestBody, RequestTemplate request) public void encode(Object requestBody, RequestTemplate request)
...@@ -105,7 +105,7 @@ public class SpringEncoder implements Encoder { ...@@ -105,7 +105,7 @@ public class SpringEncoder implements Encoder {
private class FeignOutputMessage implements HttpOutputMessage { private class FeignOutputMessage implements HttpOutputMessage {
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); private final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
private final RequestTemplate request; private final RequestTemplate request;
......
...@@ -104,8 +104,8 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient { ...@@ -104,8 +104,8 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient {
} }
protected static class RibbonServer implements ServiceInstance { protected static class RibbonServer implements ServiceInstance {
protected String serviceId; private String serviceId;
protected Server server; private Server server;
protected RibbonServer(String serviceId, Server server) { protected RibbonServer(String serviceId, Server server) {
this.serviceId = serviceId; this.serviceId = serviceId;
...@@ -127,6 +127,9 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient { ...@@ -127,6 +127,9 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient {
return this.server.getPort(); return this.server.getPort();
} }
public Server getServer() {
return server;
}
} }
} }
...@@ -117,7 +117,7 @@ public class ZuulProxyConfiguration extends ZuulConfiguration { ...@@ -117,7 +117,7 @@ public class ZuulProxyConfiguration extends ZuulConfiguration {
private ProxyRouteLocator routeLocator; private ProxyRouteLocator routeLocator;
@Autowired @Autowired
ZuulHandlerMapping zuulHandlerMapping; private ZuulHandlerMapping zuulHandlerMapping;
@Override @Override
public void onApplicationEvent(ApplicationEvent event) { public void onApplicationEvent(ApplicationEvent event) {
......
...@@ -43,7 +43,7 @@ import com.netflix.zuul.http.HttpServletRequestWrapper; ...@@ -43,7 +43,7 @@ import com.netflix.zuul.http.HttpServletRequestWrapper;
*/ */
public class Servlet30WrapperFilter extends ZuulFilter { public class Servlet30WrapperFilter extends ZuulFilter {
protected Field requestField = null; private Field requestField = null;
public Servlet30WrapperFilter() { public Servlet30WrapperFilter() {
this.requestField = ReflectionUtils.findField(HttpServletRequestWrapper.class, this.requestField = ReflectionUtils.findField(HttpServletRequestWrapper.class,
...@@ -52,6 +52,10 @@ public class Servlet30WrapperFilter extends ZuulFilter { ...@@ -52,6 +52,10 @@ public class Servlet30WrapperFilter extends ZuulFilter {
this.requestField.setAccessible(true); this.requestField.setAccessible(true);
} }
protected Field getRequestField() {
return requestField;
}
@Override @Override
public String filterType() { public String filterType() {
return "pre"; return "pre";
......
...@@ -363,7 +363,7 @@ public class SimpleHostRoutingFilter extends ZuulFilter { ...@@ -363,7 +363,7 @@ public class SimpleHostRoutingFilter extends ZuulFilter {
} }
public static class MySSLSocketFactory extends SSLSocketFactory { public static class MySSLSocketFactory extends SSLSocketFactory {
SSLContext sslContext = SSLContext.getInstance("TLS"); private SSLContext sslContext = SSLContext.getInstance("TLS");
public MySSLSocketFactory(KeyStore truststore) throws NoSuchAlgorithmException, public MySSLSocketFactory(KeyStore truststore) throws NoSuchAlgorithmException,
KeyManagementException, KeyStoreException, UnrecoverableKeyException { KeyManagementException, KeyStoreException, UnrecoverableKeyException {
......
...@@ -58,7 +58,7 @@ public class FeignClientTests extends FeignConfiguration { ...@@ -58,7 +58,7 @@ public class FeignClientTests extends FeignConfiguration {
private int port = 0; private int port = 0;
@Autowired @Autowired
TestClient testClient; private TestClient testClient;
// @FeignClient(value = "http://localhost:9876", loadbalance = false) // @FeignClient(value = "http://localhost:9876", loadbalance = false)
@FeignClient("feignclienttest") @FeignClient("feignclienttest")
......
...@@ -120,7 +120,7 @@ class HystrixOnlyApplication { ...@@ -120,7 +120,7 @@ class HystrixOnlyApplication {
} }
@Autowired @Autowired
Service service; private Service service;
@RequestMapping("/") @RequestMapping("/")
public String home() { public String home() {
......
...@@ -49,13 +49,13 @@ import static org.mockito.Mockito.verify; ...@@ -49,13 +49,13 @@ import static org.mockito.Mockito.verify;
public class RibbonInterceptorTests { public class RibbonInterceptorTests {
@Mock @Mock
HttpRequest request; private HttpRequest request;
@Mock @Mock
ClientHttpRequestExecution execution; private ClientHttpRequestExecution execution;
@Mock @Mock
ClientHttpResponse response; private ClientHttpResponse response;
@Before @Before
public void init() { public void init() {
......
...@@ -70,7 +70,7 @@ public class RibbonLoadBalancerClientTests { ...@@ -70,7 +70,7 @@ public class RibbonLoadBalancerClientTests {
RibbonLoadBalancerClient client = getRibbonLoadBalancerClient(server); RibbonLoadBalancerClient client = getRibbonLoadBalancerClient(server);
ServiceInstance serviceInstance = client.choose(server.getServiceId()); ServiceInstance serviceInstance = client.choose(server.getServiceId());
URI uri = client.reconstructURI(serviceInstance, new URL("http://" URI uri = client.reconstructURI(serviceInstance, new URL("http://"
+ server.serviceId).toURI()); + server.getServiceId()).toURI());
assertEquals(server.getHost(), uri.getHost()); assertEquals(server.getHost(), uri.getHost());
assertEquals(server.getPort(), uri.getPort()); assertEquals(server.getPort(), uri.getPort());
} }
...@@ -145,10 +145,10 @@ public class RibbonLoadBalancerClientTests { ...@@ -145,10 +145,10 @@ public class RibbonLoadBalancerClientTests {
RibbonServer ribbonServer) { RibbonServer ribbonServer) {
given(this.loadBalancer.getName()).willReturn(ribbonServer.getServiceId()); given(this.loadBalancer.getName()).willReturn(ribbonServer.getServiceId());
given(this.loadBalancer.chooseServer(anyString())) given(this.loadBalancer.chooseServer(anyString()))
.willReturn(ribbonServer.server); .willReturn(ribbonServer.getServer());
given(this.loadBalancer.getLoadBalancerStats()) given(this.loadBalancer.getLoadBalancerStats())
.willReturn(this.loadBalancerStats); .willReturn(this.loadBalancerStats);
given(this.loadBalancerStats.getSingleServerStat(ribbonServer.server)) given(this.loadBalancerStats.getSingleServerStat(ribbonServer.getServer()))
.willReturn(this.serverStats); .willReturn(this.serverStats);
given(this.clientFactory.getLoadBalancer(this.loadBalancer.getName())) given(this.clientFactory.getLoadBalancer(this.loadBalancer.getName()))
.willReturn(this.loadBalancer); .willReturn(this.loadBalancer);
......
...@@ -41,7 +41,7 @@ public class PreDecorationFilterTests { ...@@ -41,7 +41,7 @@ public class PreDecorationFilterTests {
private PreDecorationFilter filter; private PreDecorationFilter filter;
@Mock @Mock
DiscoveryClient discovery; private DiscoveryClient discovery;
private ZuulProperties properties = new ZuulProperties(); private ZuulProperties properties = new ZuulProperties();
......
...@@ -33,7 +33,7 @@ public class EurekaInstanceCanceledEvent extends ApplicationEvent { ...@@ -33,7 +33,7 @@ public class EurekaInstanceCanceledEvent extends ApplicationEvent {
private String serverId; private String serverId;
boolean replication; private boolean replication;
public EurekaInstanceCanceledEvent(Object source, String appName, String serverId, public EurekaInstanceCanceledEvent(Object source, String appName, String serverId,
boolean replication) { boolean replication) {
......
...@@ -35,7 +35,7 @@ public class EurekaInstanceRegisteredEvent extends ApplicationEvent { ...@@ -35,7 +35,7 @@ public class EurekaInstanceRegisteredEvent extends ApplicationEvent {
private int leaseDuration; private int leaseDuration;
boolean replication; private boolean replication;
public EurekaInstanceRegisteredEvent(Object source, InstanceInfo instanceInfo, public EurekaInstanceRegisteredEvent(Object source, InstanceInfo instanceInfo,
int leaseDuration, boolean replication) { int leaseDuration, boolean replication) {
......
...@@ -37,7 +37,7 @@ public class EurekaInstanceRenewedEvent extends ApplicationEvent { ...@@ -37,7 +37,7 @@ public class EurekaInstanceRenewedEvent extends ApplicationEvent {
private InstanceInfo instanceInfo; private InstanceInfo instanceInfo;
boolean replication; private boolean replication;
public EurekaInstanceRenewedEvent(Object source, String appName, String serverId, public EurekaInstanceRenewedEvent(Object source, String appName, String serverId,
InstanceInfo instanceInfo, boolean replication) { InstanceInfo instanceInfo, boolean replication) {
......
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