use of com.netflix.ribbon.DefaultResourceFactory in project ribbon by Netflix.
the class ClientPropertiesTest method testAnnotation.
@Test
public void testAnnotation() {
MyTransportFactory transportFactory = new MyTransportFactory(ClientConfigFactory.DEFAULT);
RibbonResourceFactory resourceFactory = new DefaultResourceFactory(ClientConfigFactory.DEFAULT, transportFactory);
RibbonDynamicProxy.newInstance(SampleMovieService.class, resourceFactory, ClientConfigFactory.DEFAULT, transportFactory);
IClientConfig clientConfig = transportFactory.getClientConfig();
assertEquals(1000, clientConfig.get(Keys.ConnectTimeout).longValue());
assertEquals(2000, clientConfig.get(Keys.ReadTimeout).longValue());
Configuration config = ConfigurationManager.getConfigInstance();
assertEquals("2000", config.getProperty("SampleMovieService.ribbon.ReadTimeout"));
assertEquals("1000", config.getProperty("SampleMovieService.ribbon.ConnectTimeout"));
config.setProperty("SampleMovieService.ribbon.ReadTimeout", "5000");
assertEquals(5000, clientConfig.get(Keys.ReadTimeout).longValue());
}
use of com.netflix.ribbon.DefaultResourceFactory in project ribbon by Netflix.
the class ClientPropertiesTest method testNoExportToArchaius.
@Test
public void testNoExportToArchaius() {
MyTransportFactory transportFactory = new MyTransportFactory(ClientConfigFactory.DEFAULT);
RibbonResourceFactory resourceFactory = new DefaultResourceFactory(ClientConfigFactory.DEFAULT, transportFactory);
RibbonDynamicProxy.newInstance(MovieService.class, resourceFactory, ClientConfigFactory.DEFAULT, transportFactory);
IClientConfig clientConfig = transportFactory.getClientConfig();
assertEquals(1000, clientConfig.get(Keys.ConnectTimeout).longValue());
assertEquals(3000, clientConfig.get(Keys.ReadTimeout).longValue());
assertEquals(0, clientConfig.get(Keys.MaxAutoRetriesNextServer).longValue());
Configuration config = ConfigurationManager.getConfigInstance();
assertNull(config.getProperty("MovieService.ribbon.ReadTimeout"));
config.setProperty("MovieService.ribbon.ReadTimeout", "5000");
assertEquals(5000, clientConfig.get(Keys.ReadTimeout).longValue());
}
Aggregations